Hello! Very thankful for 1.3 release providing essential fixes for undistorted images and removing the black bars.
However currently those images are somewhat useless because there is no way to export camera intrinsics suitable for undistorted images. I tried to manually calculate those matrices using OpenCV’s undistort but they don’t match with the provided images. Am I missing something or this is not implemented in any form right now?
Hi s1ddok,
the black lines removing was suppose just for Inner region settings.
I think the option for camera intrinsics wasn’t possible even before. But I could be wrong about it…
yup, I just wanted to confirm I’m not missing something. Now I wonder how can I use undistorted images if none of intrinsics is available for it. Can you share some math to calculate fx, fy for undistorted images given that I have xmps for distorted ones? I’m using inner region as well and I’m not sure how to calculate intrinsics for those images given that some arbitrary cropping is happening under the hood
Another weird thing is that with Inner region + Resolution: Fit settings sometimes the result undistorted images become larger on one axis than the original one. Is it expected?
Hi, regarding to the first issue this could be helpful: RealityCapture XMP Camera Math. Or you can try align undistorted images inside RealityCapture and then export wanted parameters.
Regarding your second question, that is expected, as Fit will provide new image according to a best fit. To have the image in same size as original, you need to use Resolution: Preserve.
Fit - keeps the resolution of the image created in the previous step.
Preserve - The resolution of the undistorted image is the same as the resolution of the original image.
I don’t think using Preserve is correct because inner region can potentially change aspect ratio of the image.
I’m able to parse XMP math using camorph but I’m not sure how to calculate undistorted intrinsics using it because your undistortion algorithm is not exposed publicly and I tried to use OpenCV2 and I checked that it doesn’t match your algorithm.
Is it possible to somehow obtain intrinsics without repaying credits for re-alignment? Since I also fix cx,cy to be in the center, I only need to recalculate fx, fy for undistorted images, but I’m not sure what would be the correct formula.
It depends on the usage of the undistorted images and what you want to use them for.
I think these equations could be used to find wanted parameters: m = K*DivisionModel^-1( x )
as you can have undistorted and distorted coordinates of some points.
As K matrix is
[ focal skew ppU
0 aspect*focal ppV
0 0 1 ]
I suppose it should be possible to make the equations to find focal.
As the undistorted images are new images and the intrinsics are some kind of export you need to license those images.
Solving equation is a bit on a harder side for me. I came up with an alternative idea: what if I export with “keep intrinsics” + resolution “preserve”, but instead of finding new f, I’ll just calculate new crop that will align with “Inner region”.
Can you share a math behind calculating “Inner region” crop?