Ask Your Question

RdlP's profile - activity

2017-07-17 05:58:03 -0500 commented question Strange values for matrix camera and distortion values

I updated the question, now I have modified the program to takes images instead video stream, also now I am using a flat pattern, and I change fisheye::distortImage by remap function but the result still looks wrong

2017-07-16 17:56:35 -0500 commented question Strange values for matrix camera and distortion values

I update the question with some of the pattern detected (I cut the image to show only the chessboard pattern)

2017-07-15 03:51:55 -0500 commented question Strange values for matrix camera and distortion values

For now i can't show image examples, but I update the question with the calibration result. I can say that the corner in the image are detected in the right place and the chessboard pattern appear in different position and also in different orientations in the input frames.

2017-07-15 03:34:24 -0500 received badge  Enthusiast
2017-07-14 14:24:09 -0500 asked a question Strange values for matrix camera and distortion values

I am trying to calibrate a fisheye camera. In order to do that I load a video take with that camera and takes frames where appears a cheesboard pattern. In order to find patterns I use:

bool found = findChessboardCorners(image_to_show, board_sz, corners, CALIB_CB_ADAPTIVE_THRESH | CALIB_CB_NORMALIZE_IMAGE | CALIB_CB_FAST_CHECK);
        if(found)
        {
            cornerSubPix(gray_image, Mat(corners), Size(11, 11), Size(-1, -1), TermCriteria(CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 30, 0.001));
            drawChessboardCorners(gray_image, board_sz, Mat(corners), found);
        }

when I take 15 pattern I calibrate the camera as follow:

double error = fisheye::calibrate(object_points, image_points, image_to_show.size(), intrinsic, distCoeffs, rvecs, tvecs, fisheye::CALIB_RECOMPUTE_EXTRINSIC | fisheye::CALIB_CHECK_COND | fisheye::CALIB_FIX_SKEW);

In this case the error is: 1.6847, then I print the intrinsic matrix and distortion coeficients and I get

Intrinsic Matrix
[251.48312, 0, 471.14383;
 0, 255.30005, 501.81467;
 0, 0, 1]

Distortion coefficients
[0.055155002;
 0.07189583;
 -0.082159713;
 0.026405662]

I think this values are wrong because the image resolution is 2048x2048, si cx and cy should be 1024 but the calibration method returns 471 and 501 for that variables.

then I try

fisheye::undistortImage(image_to_show, imageUndistorted, intrinsic, distCoeffs);

But I get a black image in imageUndistorted

This is the undistorted image that I get after calibration

Result

Image1
Image2 Image3 Image4

Edit: I modify my program to take images instead of video stream and now I am using a flat chessboard pattern.

Image1
Image2 Image3

If I use the fisheye::undistortImage the result is the same (more or less) than before, but if I use

Mat newCamMat;
Mat view, result, map1, map2;
fisheye::estimateNewCameraMatrixForUndistortRectify(intrinsic, distCoeffs, image_to_show.size(), Matx33d::eye(), newCamMat, 1);
fisheye::initUndistortRectifyMap(intrinsic, distCoeffs, Matx33d::eye(), newCamMat, image_to_show.size(), CV_16SC2, map1, map2);
remap(image_to_show, result, map1, map2, INTER_LINEAR);

I get something similar to this

result.

so, seems that fisheye::undistortImage doesn't work well. The result that I have obtanined is closer to solution but It still seems wrong. How can I get a better result?

2017-07-13 03:00:27 -0500 asked a question Error using fisheye callibration in python binding OpenCV 3.2.0

System information (version)

OpenCV => 3.2
Operating System / Platform => Linux / Ubuntu 15.04
Compiler => Python 3.4.3 (default, Mar 26 2015, 22:03:40) [GCC 4.9.2] on linux

When I try the following

ret, mtx, dist, rvecs, tvecs = cv2.fisheye.calibrate(object_points, image_points, gray.shape[::-1],None,None)

I get the next error

OpenCV Error: Assertion failed (objectPoints.type() == CV_32FC3 || objectPoints.type() == CV_64FC3) in calibrate, file /home/angelluis/Descargas/opencv-3.2.0/modules/calib3d/src/fisheye.cpp, line 726
Traceback (most recent call last):
  File "calibrate.py", line 59, in <module>
    ret, mtx, dist, rvecs, tvecs = cv2.fisheye.calibrate(object_points, image_points, gray.shape[::-1],None,None)
cv2.error: /home/angelluis/Descargas/opencv-3.2.0/modules/calib3d/src/fisheye.cpp:726: error: (-215) objectPoints.type() == CV_32FC3 || objectPoints.type() == CV_64FC3 in function calibrate

I know that this error ocurrs a time ago: https://github.com/opencv/opencv/issu... but I think that it was fixed (https://github.com/opencv/opencv/pull...) in addition, when I try the workaround explained in https://github.com/opencv/opencv/issu... it doesn't work

How can I run a fisheye calibration from python? (I don't want to use any extra oficial python wrapper)

Thanks

2017-07-12 02:40:37 -0500 commented question Calibrate 360 degree camera

Ok, but the camera takes images (or videos) with 2 images (or 2 videos) in the same file (like this: https://icdn3.digitaltrends.com/image...). Do I need select a roi with only one image (or only one video)?

2017-07-03 03:40:22 -0500 commented question Calibrate 360 degree camera

With "360 degree camera" I refer to camera that take a picture with 2 cameras and it can record all space around it, like this: https://cdn.vox-cdn.com/thumbor/WDl-l...

2017-07-03 03:37:54 -0500 received badge  Editor (source)
2017-07-03 03:21:33 -0500 asked a question Calibrate 360 degree camera

Hello,

I bought a 360 degree camera and I want to calibrate it. I know that video and images taken by 360 degree camera has metadata in the files taken.

In this metadata it is stored the camera parameters, like the matrix camera?

Thanks