Mrcal – Camera Calibrations and More
mrcal.secretsauce.net
mrcal.secretsauce.net
Dima's solutions in mrcal are way more accurate and can even accommodate manufacturing imperfections with localized warping and other less-than-perfect real world realities but for the times such things don't matter (like say correcting a webcam for your zoom calls instead of, say, landing on mars), there's always lenscorrection.
If you're trying to set up a really basic pipeline for lens correction (more like adjustment) in linux that works with the web browser and apps here's a gross simplification
1. create a virtual v4l device with the v4l2loopback module, set exclusive_caps=1 (example: modprobe v4l2loopback devices=1 exclusive_caps=1)
2. Do something like ffmpeg -i /dev/video0 -vf "lenscorrection=cx=0.5:cy=0.5:k1=-0.015:k2=-0.072" -f v4l2 /dev/video2 where the first argument is the real video and the second is the virtual (do v4l2-ctl --list-devices) to see the devices
3. Point teams or whatever to the virtual device, /dev/video2 in this example.
You can use this same trick to force resolutions, compression ratios, rotate and mirror webcams - it's pretty useful.
Agreed that its purpose is not to make a map. It is designed to handle the case where the camera is in the same position for every picture.
mrcal actually gives you real uncertainties, so you can get proper feedback about what you're doing. There's a whole lot to say on this topic. If you're interested, read the docs. The "tour of mrcal" page gives a good overview.
i went and fed it some real world images that should've been near-worthless for alignment (blue sky, empty fields) and hugin immediately produced a great alignment with no effort.
so... there's definitely room for some alternative software in this space. i'm excited to give mrcal a go when i've got the time.
So when I take RAW files from my canon DSLR and load them through a compatible raw processing software, it knows the lens and camera used to take the picture and it will correct those distortions, and sometimes deal with chromatic aberation etc.
We would write pipeline modules that could calibrate for specific lenses (think chromatic aberration and vignetting).
Every lens that is manufactured is slightly different, and has a slightly different ray-in-space to pixel mapping that these tools help you obtain.