Ask Your Question

venushkathisara's profile - activity

2015-04-25 20:19:37 -0600 received badge  Editor (source)
2015-04-25 08:37:01 -0600 asked a question prints the values of disparity map

I'm developing 3D application I have printed disparity map Mat data, but I'm having trash data with correct data (I think it’s correct). In order to generate 3D point cloud

  1. want to make sure I printed the correct disparity map data ( what are the point[0] ,point [1], point[2])
  2. In order to generate 3D point cloud how do I use these data

Please find below the code I used for data of disparity map and printed results ( some of ). Any help is appreciated.

   static void saveXYZ(const char* filename, const Mat& mat)

{

        Vec3f point = mat.at<Vec3f>(y, x);

        FILE* fp = fopen(filename, "wt");

        for (int y = 0; y < mat.rows; y++)

        {


                for (int x = 0; x < mat.cols; x++)

                {
                        fprintf(fp, "%f %f %f\n", point[0], point[1], point[2]);

                        printf("%f %f %f\n", point[0], point[1], point[2]);



                }

        }

        fclose(fp);

}

output

-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-17813.333984 -24426.666016 128000.000000
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-10181.818359 -14482.213867 75889.328125
-10015.748047 -14425.197266 75590.554688
-9928.853516 -14482.213867 75889.328125
-9763.779297 -14425.197266 75590.554688
-14400.000000 -21552.941406 112941.179688
-14046.511719 -21302.326172 111627.906250
-1.#INF00 -1.#INF00 1.#INF00
-261333.328125 -407111.125000 2133333.250000
-232000.000000 -366400.000000 1920000.000000
-228800.000000 -366400.000000 1920000.000000
-225600.000000 -366400.000000 1920000.000000
-222400.000000 -366400.000000 1920000.000000
-199272.734375 -333090.906250 1745454.500000
-10964.466797 -18598.984375 97461.929688
-10747.474609 -18505.050781 96969.695313
-11453.551758 -20021.857422 104918.031250
-11278.688477 -20021.857422 104918.031250
-11103.825195 -20021.857422 104918.031250
-10810.810547 -19805.406250 103783.781250
-10524.064453 -19593.582031 102673.796875
-10352.941406 -19593.582031 102673.796875
-10181.818359 -19593.582031 102673.796875
-10010.695313 -19593.582031 102673.796875
-20000.000000 -39826.085938 208695.656250
-19652.173828 -39826.085938 208695.656250
-19516.484375 -40263.734375 210989.015625
-19164.835938 -40263.734375 210989.015625
-18813.187500 -40263.734375 210989.015625
-46666.667969 -101777.781250 533333.312500
-1.#INF00 -1.#INF00 1.#INF00
-67333.335938 -152666.671875 800000.000000
-63360.000000 -146560.000000 768000.000000
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-5082.353027 -14368.627930 75294.117188
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-4454.901855 -14368.627930 75294.117188
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-1.#INF00 -1.#INF00 1.#INF00
-10042.552734 -38978.722656 204255.312500
-9600.000000 -38568.421875 202105.265625
-7652.173828 ...
(more)
2015-04-22 23:26:25 -0600 asked a question Stereo rectifying Issue

I'm new to opencv and its developing. Im developing 3D application. There i have used Harries feature detector to detect the keypintto s and as a descriptor i used SIFT and in order to match the keypoints i used FLANN macher. upto that im have very good results. My image- (http://i.imgur.com/RrLcJMr.jpg) i want to rectify my image like this image - http://code.opencv.org/attachments/78...

in order make the Disparity map i used following stereo matching way

for (int i = 0; i < good_matches.size(); i++)
    {
        //-- Get the keypoints from the good matches
        right.push_back(keypoints_right[good_matches[i].queryIdx].pt);
        left.push_back(keypoints_left[good_matches[i].trainIdx].pt);
    }

    Mat H = findHomography(right, left, CV_RANSAC);


    // print number of good maches
    printf("Number of good machers %i \n", good_matches.size());

    vector<KeyPoint> rightKeyp;
    vector<KeyPoint> leftKeyp;

    con.convert(right, rightKeyp);
    con.convert(left, leftKeyp);

    Mat fundametal = findFundamentalMat(right, left, FM_RANSAC, 3, 0.99);


    Mat homRight;
    Mat homLeft;

    stereoRectifyUncalibrated(right, left, fundametal, input_center.size(), homLeft, homRight);

    warpPerspective(input_right, input_right, homRight, input_right.size());
    warpPerspective(input_left, input_left, homLeft, input_left.size());

But im not getting the good rectified pair. Please help me to get the rectified pair. Thank You.