GoPro Camera Field of View

I calibrated my GoPro Hero 4 Black with the camera calibration tool for Matlab and calculated its field of view and focal length using OpenCVMatrixValues ​​() calibration. However, they differ from the GoPro specifications. Going out of 118.2 / 69.5 FOVs I get 95.4 / 63.4 and a focal length of 2.8 mm instead of 17.2 mm. Obviously, something is wrong.

I believe the calibration itself is correct, as the image of an unspecified image works well.

Someone please give me a hint where I made a mistake? I am posting my code below.

Thanks.

code

cameraMatrix = new Mat(3, 3, 6); for (int i = 0; i < cameraMatrix.height(); i ++) for (int j = 0; j < cameraMatrix.width(); j ++) { cameraMatrix.put(i, j, 0); } cameraMatrix.put(0, 0, 582.18394); cameraMatrix.put(0, 2, 663.50655); cameraMatrix.put(1, 1, 582.52915); cameraMatrix.put(1, 2, 378.74541); cameraMatrix.put(2, 2, 1.); org.opencv.core.Size size = new org.opencv.core.Size(1280, 720); //output parameters double [] fovx = new double[1]; double [] fovy = new double[1]; double [] focLen = new double[1]; double [] aspectRatio = new double[1]; Point ppov = new Point(0, 0); org.opencv.calib3d.Calib3d.calibrationMatrixValues(cameraMatrix, size, 6.17, 4.55, fovx, fovy, focLen, ppov, aspectRatio); System.out.println("FoVx: " + fovx[0]); System.out.println("FoVy: " + fovy[0]); System.out.println("Focal length: " + focLen[0]); System.out.println("Principal point of view; x: " + ppov.x + ", y: " + ppov.y); System.out.println("Aspect ratio: " + aspectRatio[0]); 

results

 FoVx: 95.41677635378488 FoVy: 63.43170132212425 Focal length: 2.8063085232812504 Principal point of view; x: 3.198308916796875, y: 2.3934605770833333 Aspect ratio: 1.0005929569269807 

GoPro Specifications

https://gopro.com/help/articles/Question_Answer/HERO4-Field-of-View-FOV-Information

Edit

Matlab Calibration Results

 Focal Length: fc = [ 582.18394 582.52915 ] ± [ 0.77471 0.78080 ] Principal point: cc = [ 663.50655 378.74541 ] ± [ 1.40781 1.13965 ] Skew: alpha_c = [ -0.00028 ] ± [ 0.00056 ] => angle of pixel axes = 90.01599 ± 0.03208 degrees Distortion: kc = [ -0.25722 0.09022 -0.00060 0.00009 -0.01662 ] ± [ 0.00228 0.00276 0.00020 0.00018 0.00098 ] Pixel error: err = [ 0.30001 0.28188 ] 

One of the images used for calibration 13.jpg

And undistorted image _rect13.jpg

+5
source share
1 answer

You entered 6.17 mm and 4.55 mm for the sensor size in OpenCV, which corresponds to an aspect ratio of 1.36 , while your resolution (1270x720) is 1.76 (approximately 16x9 format). Did you crop the image before calibrating MATLAB?

The pixel size seems to be 1.55 microns from this Gopro page (which, incidentally, is surprisingly small!). If the pixels are squared and they should be on this type of commercial camera, this means that your inputs are not consistent. The estimated size of the sensor should be:

[Sensor Width, Sensor Height] = [1280, 720] * 1.55 * 10 ^ -3 = [1.97, 1.12] mm

Even if we consider the maximum video resolution, which is 3840 x 2160, we get [5.95, 3.35]mm , which is still different from your input.

Please read this equivalent focal length explanation to understand why the actual focal length of the camera is not 17.2 , but 17.2*5.95/36 ~ 2.8mm. In this case, calculate the FOV using the formulas here , for example. You will really find 93.5 ° / 61.7 ° (close to your outputs, but still not what is written in the specifications, because there are probably some optical distortions due to wide angles).

What I don't understand is how the returned focal length can be correct, while the entered sensor size is incorrect. Could you give more information and / or send an image?

Editing after updating questions

On these cameras with a working resolution of 1280x720, the image is reset, but not cropped, so what I said above about the size of the sensor does not apply. The size of the sensor to be considered is indeed the one used (6.17x4.55), as explained in your first comment.

FOV is limited to the inputs of the calibration matrix (fx, fy, cx, cy) specified in pixels and resolution. You can check it by typing:

2*DEGRES(ATAN(1280/(2*582.18394))) (= 95.416776 ... °)

This FOV value is less than expected, but by the appearance of the undistorted image, your MATLAB distortion model is correct and the calibration is correct. The barrel distortion due to the large angle seems to be well adjusted with the repetition you use.

However, the MATLAB toolkit uses a pinhole model that is linear and cannot account for internal parameters, such as lens distortion. I assume this from the page:

https://fr.mathworks.com/help/vision/ug/camera-calibration.html

Therefore, I think that if you do not find a model that is more suitable for the Gopro camera (possibly a wide-angle lens model), MATLAB calibration will return the camera’s internal matrix corresponding to the “linear” undistorted image, and the FOV will really be less (in case of distortion trunk). You will need to apply the calibration distortion factors to get the actual FOV.

In the corrected image, we can see that the side parts of the FOV deviate out of bounds. If you have completely distorted the image, you will find that some undistorted pixel coordinates exceed [-1280/2;+1280/2] (both horizontally and vertically). Then, replacing opencv.core.Size(1280, 720) with the most extreme ranges, you hopefully extract the values ​​of the Gopro website.

In conclusion, I think you can rely on the value of the focal length that you received if you take measurements in the center of your image, otherwise there are too many distortions and it does not apply.

+3
source

Source: https://habr.com/ru/post/1258148/


All Articles