[FFmpeg-devel] ffmpeg-filter: lenscorrection parameters converted from OpenCV
Paul B Mahol
onemda at gmail.com
Fri Feb 19 12:20:29 EET 2021
On Fri, Feb 19, 2021 at 10:16 AM 王康(五达) <wangkang.wk at alibaba-inc.com> wrote:
> Hi Paul,
>
> I figured out that parameters (k1, k2) used in `vf_lenscorrection.c` is
> different from (k1, k2) calculated from OpenCV chessboard methods.
>
> In summary:
>
> The k1,k2 parameters in `vf_lenscorrection.c` should be converted in this
> way:
>
> corrected_k1 = (w**2 + h**2) / (4 * f**2) * opencv_calculated_k1
> corrected_k2 = ((w**2 + h**2) / (4 * f**2)) **2 * opencv_calculated_k2
>
And what is "f" parameter?
> Detail with equations can be found in the attachment html file for your
> consideration. Perhaps you can add a new option or update the document.
> Hopefully this will help other users.
>
>
> --
> Wang Kang
> Alibaba Group
>
> -
>
> OpenCV: Principle
> <https://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#initundistortrectifymap>,
> Code
> <https://github.com/opencv/opencv/blob/199ddff13b73071529a42cff97ee8286cfc15d02/modules/calib3d/src/undistort.dispatch.cpp#L377>
> -
> -
> -
> -
> -
> -
>
> ffmpeg/libavfilter/vf_lenscorrection.c: Code
> <https://build.verhagen.dev/scverhagen/FFmpeg/blob/e3212bfd1493be2c04e78b3a2e998d90c49e3935/libavfilter/vf_lenscorrection.c#L92>,
> Early version in github
> <https://github.com/FFmpeg/FFmpeg/blob/9f617a14a00805ffd54dee4fce34e3e4099d21f3/libavfilter/vf_lenscorrection.c>
> -
> -
> - From the document:
> -
> -
> -
>
> The parameters in lenscorrection should be:
> -
> -
> -
> -
> -
> -
>
> Let's take a picture with the dimension of 1600x1200, focal length of
> 1280.5 as an example. The parameters in lenscorrection should be:
> -
> -
> -
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: temp4cj.png
Type: image/png
Size: 164241 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210219/d16e2922/attachment.png>
More information about the ffmpeg-devel
mailing list