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.

Hi Ram,

I am working on similar problem too (fish eye camera undistortion). Did you find a solution? If so, can you please share some sample code of your shader?

Thanks,
Artem.

Hi Artem,

Still we could not find solution, how to do fisheye camera undistortion in OPENGL ES.

@CarlosSarria
I have few questions regarding undistortion

  1. I believe Camera intrinsic parameters are required to do undistortion, Is this correct?
  2. If Yes, How to give these parameters in OPENGL ES for undistortion fisheye image?

Thanks,
Ram.

Hi Artem,

OpenGL ES cannot do magic. You have to use the vertex or the fragment shader to move the pixels to the right location. You need to work-out the algorithm yourself and pass the camera intrinsic parameters as uniforms. I gave you an example we used for barrel distortion for VR. Obviously this is not the same algorithm you might require in your case, but I suppose you can adapt it to your needs. Here you have an example that might help you.

Regards.

Carlos.

Hi Carlos,

Thanks for your reply. I will do my best to create an algorithm by myself.

Regards,
Artem.

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