Ask Your Question

dandur's profile - activity

2016-07-27 00:39:27 -0500 commented question findChessboardCorners returing false boolean value?

You get false because you use wrong pattern size 8x6 instead 9x6.

2016-07-26 02:57:04 -0500 commented question OpenCV 3 doxygen documentation still very counter intuitive

I'm also missing pdf documentation for new OpenCV.

2016-07-22 14:31:33 -0500 answered a question Camera calibration and aspect ratio

The correct way is not using CALIB_FIX_ASPECT_RATIO flag or set this flag and apply aspect ratio in initial camera matrix. It is strange that first approach doesn't work in your case. Can you show your calibration code?

Also, for better accuracy I would recomend you calibrate camera with native resolution and then rescale camera matrix (distortion coefficents remain the same). For recovering scale (and maybe crop) parameters take some shots of calibration rig with native and working resolution. Then find transformation between corners coordinates on different resolution. The transformation will have a form:

new_x = (x - crop_x) * scale_x
new_y = (y - crop_y) * scale_y

Also note that crop_x and crop_y should be integer values and scale_x and scale_y are probably rational values. Finaly rescale camera matrix parameters:

new_fx = fx * scale_x
new_fy = fy * scale_y
new_cx = (cx - crop_x) * scale_x
new_cy = (cy - crop_y) * scale_y

UPD I just thought that your problem may be related to the wrong parameter newCameraMatrix in initUndistortRectifyMap. Use getOptimalNewCameraMatrix for this parameter.

2016-07-22 01:31:25 -0500 answered a question Measuring Planar Objects with a Calibrated Camera

There's no analog for pointsToWorld as I know. You can find x and y (z is equal zero in such case) like this:

  1. apply cv::undistortPoints to your pixel coordintes (let's u and v) and get ideal coordinates (un and vn)
  2. solve system of linear equations:

    w * [un vn 1] = Rt * [x y 0 1]

that gets you

r11 * x + r12 * y - w * un = -t1;
r21 * x + r22 * y - w * vn = -t2;
r31 * x + r32 * y - w = -t3;

Here x and y are coordinates in chessboard plane, w is distant to point from camera, rij are components of rotation matrix and ti are components of translation vector.

2016-07-21 02:13:40 -0500 received badge  Enthusiast
2016-07-19 07:49:33 -0500 received badge  Supporter (source)
2016-07-19 02:22:30 -0500 answered a question How to remove unwanted corners in images?

If you make your images with equal size you can blend them together with simple addition. Alpha channel is not need for this.

2016-07-18 07:59:51 -0500 answered a question Can't open image from Python

You use invalid path. Try this (note 'r' before path):

img = cv2.imread(r"C:\Users\XXXX\map.tif")

Or use \\:

img = cv2.imread("C:\\Users\\XXXX\\map.tif")
2016-07-15 18:28:32 -0500 received badge  Teacher (source)
2016-07-15 08:27:07 -0500 received badge  Editor (source)
2016-07-15 07:54:33 -0500 answered a question Generating middle image using stereo image(two images)

There's no single function solution. The final result depends on various conditions. I would do the folowing:

  1. Compute disparity map with left and right images (with using cv::StereoSGBM). Note that disparity relates to the left image.

  2. (Optional) postprocess disparity map. Fill gaps etc.

  3. Recompute disparity map to the middle view (DispM). First init middle disparity with negative (invalid values). Then reproject left disparity to middle:

    d = DispL[x,y] / 2 # divide by two because disparity for middle view less then for right view

    if x-d > 0 and DispM[x-d,y] < d: DispM[x-d,y] = d

  4. Possible postprocess DispM to fill gaps

  5. Remap left image to the middle view with cv::remap. The tables for remapping calculated with folowing:

    mapy[x,y] = y

    mapx[x,y] = x - DispM[x,y]

2016-07-14 10:23:49 -0500 answered a question Calibration with circle grid - center of gravity is not the circle center - is this implemented?

As I know cv::findCirclesGrid uses SimpleBlobDetector by default. This detector searches a center of a circle and not corrects perspective distortions. Further in function cv::findCirclesGrid input image or contours are not used. So, the answer to you question is now.

But, the interface of cv::findCirclesGrid function has detector parameter. That means you can write your own detector which corrects centers of circles.