I am currently trying to generate 3D points with stereo image pair in OpenCV. This has been done a lot as far as I can find.
I know the external standards of the stereo setup which I would consider that it is in the front parallel configuration (in fact, it is not bad!). I know focal length, baseline, and I'm going to accept the main point in the form of the center of the image (I know, I know ...).
I calculate a psuedo-decent inequality map, using the stereo SGMM and hand, the Q matrix has been coded after O'Reilly's linings OpenCivi book, which states:
Q = [0 0 -c_x 0 1 0 -c_y 0 0 f f0 0 -1 / t_x (c_x - c_x ') / t_x] I That is the main point (c_x, c_y) that I specify in the image coordinates, f focal length (which i have described in mm), and t_x two cameras or baseline (i Nne also translate between described in mm).
int type = CV_STEREO_BM_BASIC; Double rescx = 0.25, recesi = 0.25; Mat inequality, vdisparity, depth map; Mat frame 1 = ("C: \\ user \\ administrator \\ desktop \\ flow \\ IMG137.jpg", cv_load_IMUnURRACLL); Mat frame 1l = frame 1 (range (0, frame 1. ro), range (0, frame 1 colos / 2)); Mat frame 1 r = frame 1 (range (0, frame 1. ro), range (frame 1 cylol / 2, frame 1 calls)); Size (frame 1 L, frame 1 L, size (), rescx, receiver); Size (frame 1r, frame 1r, size (), rescx, receiver); Intprefilter size = 9, prefilter cap = 32, inequality range = 4; Int minDisparity = 2, Texture border = 12, Specification = 3; Int windowcissue = 21, smooth P1 = 0, smooth P2 = 0, dimmaxid = 32; Int speclarens = 0, biscuits and sizes = 0; Boolean dynamic P = false; Stereo SGBM stereo (mins disparity * -16, inequality range * 16, window sieces, smooth p1, smooth p2, dimmaxdiff, prefilter cap, specialty reti, spychlorange * 16, biscay woundosys, dynamic p); Stereo (frame 1l, frame1r, inequality); Double M1 [3] [3] = {{46, 0, frame 1l chrome}, {0, 46, frame 1 ltd. Row 2}, {0, 1}}; Double T1 [3] = {65, 0, 0}; Double quote [4] [4] = {{1, 0, 0, -frame1L.cols / 2.0}, {0, 1, 0, -frame1l.rows / 2.0}, {0, 46}, {0 , 0, -1.0 / 65, 0}}; The mat cm1 (3, 3, cv_64f, m1), cm2 (3, 3, cv_64f, m1), t (3, 1, cv_64f, t1); Mat R1, R2, P1, P2; Mat Q (4, 4, cv_64f, q); // Stereorectifx (CM1, Mate :: Jereos (5, 1, cv_64f), cm2, mate :: jeros (5, 1, cv_64f), frame 1 sce (), mate :: eye (3 , 3, cv_64f) t, r1, r2, p1, p2, q); General (inequality, vdisparity, 0, 256, NORM_MINMAX); // Convert scalab (inequality, inequality, 1 / 16.0); ReprojectImageTo3D (Inequality, Depth Icon, Q, True); Imshow ("inequality", vdisparity); Imshow ("3D", depth map); So I feed the resultant inequality from stereo SGbm and feed that quote matrix to get the 3D digit, which I write in a ply file.
But the result is:
I am happy to see, but I do not need it :( I have read it online after 16 splitting the map of inequality and actually It looks better in this (actually it seems that the camera took the shot!).
If you are interested then this is a map of my inequality:
Know that without co-operation, it's probably going to look like the best 3D projection And I was expecting some things ... better.
Any suggestions?
Under the Franco-Paralye concept, there is a connection between the inequality and depth of 3D: D = F * T / Z , where D is inequality, F is the focal length, T is the base line and the depth of Z 3D. If you see the image center as the main point, then 3D coordinate system is settled, then a pixel (px, py) , its 3D coordinate is (x, y, z) : X = (px-cx) * z / f, y = ( Px-cy) * z / f, z = f * t / d , where pixel coordinate of cx, cy image center. Your inequality image looks great and it can generate a proper 3D point cloud.
A simple inequality browser.
Comments
Post a Comment