# Real time camera calibration

**URL:** <https://forum.opencv.org/t/real-time-camera-calibration/18387>\
**Category:** Python\
**Created:** [July 31, 2024, 2:09pm UTC](https://forum.opencv.org/t/real-time-camera-calibration/18387 "2024-07-31T14:09:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tboonstl](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@tboonstl](https://forum.opencv.org/u/tboonstl)\
**Post date:** [July 31, 2024, 2:09pm UTC](https://forum.opencv.org/t/real-time-camera-calibration/18387/1 "2024-07-31T14:09:55Z")

</div>

I am a newbie and using a wide angle video camera and have calibrated it to undistort (using a checkerboard).

Is it possible on a Jetson or similarly more powerful CPU to correct the distortion in real-time? Maybe by remapping pixel by pixel or some other way?

Thanks in advance for any help!

---

<div class="post-metadata">

**Author:** ![Steve\_in\_Denver](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Steve\_in\_Denver](https://forum.opencv.org/u/Steve_in_Denver)\
**Post date:** [July 31, 2024, 4:29pm UTC](https://forum.opencv.org/t/real-time-camera-calibration/18387/2 "2024-07-31T16:29:57Z")

</div>

> [@tboonstl](#):
>
> s it possible on a Jetson or similarly more powerful CPU to correct the distortion in real-time? Maybe by remapping pixel by pixel or some other

It depends on what you mean by real time, I suppose. It depends on the size of the image and how many images per second you want to undistort, but it’s definitely possible for a range real-world use cases.

Using OpenCV the cv::undistort() function will undistort an image based on the camera matrix and distortion coefficients. You can speed this up by splitting this into two calls:

cv::initUndistortRectifyMap() – called one time to generate the undistort map  
cv::remap() – called on each image you wish to undistort, using the maps generated above.

The interpolation type you use will affect runtime performance, too.

If you have a GPU to work with, you could do a mesh-based texture-mapped de-warp. I suspect this would be blisteringly fast on modern hardware.

---

<div class="post-metadata">

**Author:** ![tboonstl](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@tboonstl](https://forum.opencv.org/u/tboonstl)\
**Post date:** [August 1, 2024, 2:22pm UTC](https://forum.opencv.org/t/real-time-camera-calibration/18387/3 "2024-08-01T14:22:40Z")

</div>

Thanks for the quick reply. I have a project that will have varying wide-angle cameras in use. But, I want to record 1080 videos without distortion. A hardware correction is not practical (and expensive).

I have done post-processing undistortion routines for images. However, I am trying to find a way to undistort videos in real time and, if needed, am willing to use a separate processor just for that.

I can use a checkerboard, take pictures and a python script to determine the correction parameters for each camera/location that could be the input for the process.

Could the two-call system on a separate CPU/GPU you spoke about be able to do this in real time (i.e., be able to record a 1080 undistorted video)?

---

<div class="post-metadata">

**Author:** ![Steve\_in\_Denver](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Steve\_in\_Denver](https://forum.opencv.org/u/Steve_in_Denver)\
**Post date:** [August 1, 2024, 4:22pm UTC](https://forum.opencv.org/t/real-time-camera-calibration/18387/4 "2024-08-01T16:22:14Z")

</div>

I would think with a decent GPU you should have no problem at all doing this in terms of compute power. I don’t have any recent experience, but 15 years ago I was doing 1080 mesh-based warps in sub-millisecond times. In your case you have to also get the image data onto the GPU, but I don’t imagine that will be a performance bottleneck at all. So yes, I think it’s totally doable, but You’ve got to be able to write the code to do it.

---

<div class="post-metadata">

**Author:** ![tboonstl](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@tboonstl](https://forum.opencv.org/u/tboonstl)\
**Post date:** [August 1, 2024, 9:04pm UTC](https://forum.opencv.org/t/real-time-camera-calibration/18387/5 "2024-08-01T21:04:39Z")

</div>

I am not very advanced in writing this stuff and would like to get it done as soon as I can. Can you or anyone you know write that code? Of course, I would pay for the work.

Thanks.

---

<div class="post-metadata">

**Author:** ![Steve\_in\_Denver](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Steve\_in\_Denver](https://forum.opencv.org/u/Steve_in_Denver)\
**Post date:** [August 2, 2024, 7:20pm UTC](https://forum.opencv.org/t/real-time-camera-calibration/18387/6 "2024-08-02T19:20:28Z")

</div>

I keep pretty busy at work and don’t have time to take on additional projects at this point.

---

<div class="post-metadata">

**Author:** ![tboonstl](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@tboonstl](https://forum.opencv.org/u/tboonstl)\
**Post date:** [August 4, 2024, 5:39pm UTC](https://forum.opencv.org/t/real-time-camera-calibration/18387/7 "2024-08-04T17:39:02Z")

</div>

I understand totally. Thanks for the help!
