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

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


f is focal length, for example, a camera with the dimensions of 1600x1200, the focal length in X we measured is 1280.5

Btw: you may want to check the png and html file attached in the last mail, which contains several LaTeX rendered equations.

Cheers,


-- 
Wang Kang
 ------------------Original Mail ------------------
Sender:Paul B Mahol <onemda at gmail.com>
Send Date:Fri Feb 19 18:20:44 2021
Recipients:王康(五达) <wangkang.wk at alibaba-inc.com>
CC:ffmpeg-devel <ffmpeg-devel at ffmpeg.org>
Subject:Re: ffmpeg-filter: lenscorrection parameters converted from OpenCV



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, 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/8a660bc3/attachment.obj>


More information about the ffmpeg-devel mailing list