[FFmpeg-devel] ffmpeg-filter: lenscorrection parameters converted from OpenCV

王康(五达) wangkang.wk at alibaba-inc.com
Fri Feb 19 11:16:04 EET 2021


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

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, Code




 
ffmpeg/libavfilter/vf_lenscorrection.c: Code, Early version in github


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: application/octet-stream
Size: 164241 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210219/26d12311/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: notes.html
Type: application/octet-stream
Size: 88753 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210219/26d12311/attachment-0001.obj>


More information about the ffmpeg-devel mailing list