Imagination PowerVR SDK Blog

Fish eye camera image undistortion using OpenGL ES

Hi,

I am new to OpenGL ES.
Currently working on Fisheye camera, able to display fisheye camera raw data on HDMI monitor using OPENGL ES rendering.
I could not find sample code to do fisheye image undistortion.
Can you please help me to provide sample code for image undistortion in shaders code.

Thanks,
Ram.

Hi Ram,

I have attached a bit of code to do barrel distortion (this is used for VR). If you create a highly tessellated rectangle where to project your images, this code will move the vertices to distort the image. Play with the BarrelPower parameter until your distortion is corrected. The file is a PFX from where you should be able to extract the vertex and fragment shader. Hope this helps :slight_smile:

Regards

Carlos.
barrel.zip (897 Bytes)

Hi Carlos,

Thank you for your reply.
I am looking Fish eye image undistortion.
The input of Fish eye image itself is distorted. We have to undistortion the fish eye image.
For eg: In Opencv “remap” function is used to undistrot the fish eye image.
Similar type of any API is there in OpenGL ES to do undistortion, if not Can you please provide some sample code how to do undistortion.

Thanks,
Ram.

Hi Ram,

With the code I attached you can correct the distortion of the original (distorted) image. You might need to modify it to adapt it to your needs but it should work.

Regards.

Carlos.

Hi Carlos,
The code which you sent it is for distortion.
In our case we have to do undistortion based on camera intrinsic parameters.
Please Find the attached input and output images.

Please let me know your comments.

Thanks,
Ram.

Hi Ram,

The purpose of the code I sent you is different (it is for VR barrel distortion) so you need to modify it to fulfil your needs. I am surprised how well it works so probably it does not require many changes to convert it into a proper “unspherize” shader. This is something you will need to do yourself.

Best regards.

Carlos.

© Imagination Technologies Limited. All rights reserved.
Privacy PolicyTerms & ConditionsTrademarksCookies