# Use "distortPoints" to apply barrel distortion to an image

**URL:** <https://forum.opencv.org/t/use-distortpoints-to-apply-barrel-distortion-to-an-image/9034>\
**Category:** Python\
**Tags:** calib3d, distortion, calibratecamera\
**Created:** [June 3, 2022, 5:57pm UTC](https://forum.opencv.org/t/use-distortpoints-to-apply-barrel-distortion-to-an-image/9034 "2022-06-03T17:57:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nb\_xyz](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@nb\_xyz](https://forum.opencv.org/u/nb_xyz)\
**Post date:** [June 3, 2022, 5:57pm UTC](https://forum.opencv.org/t/use-distortpoints-to-apply-barrel-distortion-to-an-image/9034/1 "2022-06-03T17:57:01Z")

</div>

Hi,  
My usecase is as follows: Given a rectilinear image, apply a barrel distortion to it.  
I have my camera calibrated and have the K and D matrices. I use a mesh grid. Convert the coordinates to homogenous, multiply with K inv and then send them to cv2.distortPoints(). Now the output of this does not seem to be reasonable. How do I use this output get the distorted image?  
Thanks

---

<div class="post-metadata">

**Author:** ![Eduardo](https://avatars.discourse-cdn.com/v4/letter/e/6a8cbe/32.png) [@Eduardo](https://forum.opencv.org/u/Eduardo)\
**Post date:** [June 8, 2022, 1:38pm UTC](https://forum.opencv.org/t/use-distortpoints-to-apply-barrel-distortion-to-an-image/9034/2 "2022-06-08T13:38:54Z")

</div>

> My usecase is as follows: Given a rectilinear image, apply a barrel distortion to it.

Probably you should use [`cv::remap()`](https://docs.opencv.org/4.x/da/d54/group __imgproc__ transform.html#gab75ef31ce5cdfb5c44b6da5f3b908ea4).
