Forum Discussion
doktorvr
12 years agoExplorer
Shader to undistort webcam video for AR Rift
I am building an AR display using the Rift and attaching two webcams to the front. I have two 120 degree webcams and am texturing two planes in my Unity scene with live the video feed using WebCamTexture. The plane has the same 1:1.78 aspect ratio as the webcam feed.
However, simply projecting the webcam video onto this flat plane of course suffers from normal barrel distortion of cheap cameras. This distortion is particularly pronounced as the cameras have a wide (120 degree) field-of-view lens.
I assume a shader would be the best way to correct for this distortion. The other possibility would perhaps be projecting the webcam video onto a mesh geometry that is the inverse of the webcam lens distortion. However, the shader approach seems to be the more general solution.
Does anyone have any ideas to get started on this? I have calibrated my camera with OpenCV and so I have the camera's distortion coefficients.
However, simply projecting the webcam video onto this flat plane of course suffers from normal barrel distortion of cheap cameras. This distortion is particularly pronounced as the cameras have a wide (120 degree) field-of-view lens.
I assume a shader would be the best way to correct for this distortion. The other possibility would perhaps be projecting the webcam video onto a mesh geometry that is the inverse of the webcam lens distortion. However, the shader approach seems to be the more general solution.
Does anyone have any ideas to get started on this? I have calibrated my camera with OpenCV and so I have the camera's distortion coefficients.
2 Replies
Replies have been turned off for this discussion
- jongallowayHonored GuestDo you have any screenshots?
- cyberealityGrand ChampionYes, a shader will be a good way to do this.
This page seems to have the algorithm you need:
http://stackoverflow.com/questions/6199636/formulas-for-barrel-pincushion-distortion
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 12 years ago
- 10 years ago