How to Feed Images into Open CV Lens Distortion Calibrator

Hello, I’m currently trying to use the OpenCv Lens Distortion plugin that comes installed by default with the Virtual Production example in Unreal 4.27 to try and create a camera undistortion texture for my camera. So far I have had no issue getting this to work with by manually setting the lens distortion parameters (K[1-6], P1, P2, etc.) but now I want to automatically generate this data using a series of images from my camera. To do this I threw together a blueprint (couldn’t get access to OpenCV from C++ scripts) that takes a directory, grabs all jpg files and feeds them into the calibrator.

Unfortunately no matter what I try the calibrator refuses to accept any of my test images, and since this is a blueprint I can’t really debug the problem any more, all I know is that the FeedImage node returns false for every image. I’ve tried searching for documentation or tutorials using OpenCV Lens Distortion but for some reason it is a completely undocumented feature besides a couple pages saying the nodes exist and 2 or 3 questions on this answer hub asking how to turn the distortion variables into a texture. If anyone knows what I might be missing please let me know.

Just for reference, here is a sample of one of my test images:

Board Width: 10
Board Height: 7
Square Size: 3.2727 cm

Update:
I was able to get OpenCV working directly from an external python script but I am still unable to get it working in Unreal. Obviously the functions are difference since Python deals directly with OpenCv while Unreal is using a blueprint wrapper but at least I know the images and calibrator settings should be valid.

2 Likes