Image Flattening
Upon successfully obtaining the camera matrix, this matrix could then be used to undistort images while maintaining the same field of vision. In the case of the SJ4000, it has a 170° field of vision. However, the math behind image flattening is not a perfect function which is able to map the pixels with 100% accuracy while maintaining the same resolution as the original distorted image. Hence, there is a loss when flattening the images in terms of its resolution, as can be seen in the following figures.
As can be seen in the figure above, the raw image after undistortion looks far more warped compared to the original image. However, this brings about the concept of having a region of interest (ROI). The ROI for this image is at the center, where the image has been flattened. By cropping the image and making use of only the ROI, we are able to make use of a fully flattened image for all image processing operations. However, the pixel density is lower than the original image due to the nature of the undistort() function in OpenCV.