0

I got a photo from a Fisheye camera and I need to do a camera calibration.

Now I knew the point like A in the photo, after fisheye::initUndistortRectifyMap(cameraMatrix, distCoeffs, Mat(),dst_cameraMatrix,imageSize*2, CV_32FC1, map_x, map_y function I got map_x,map_y. And I use remap to get calibration result.

Now I want to know the point position A after calibration, I looked document on Opencv and searched some relative questions, but almost all of them are based on the same size as original image size, But know I increased the image size by *2.

In this way, how can I get the point position A after calibration.

Below are my code:

    Mat distortRectify;
    Mat cameraMatrix = Mat::eye(3, 3, CV_64F);
    Mat dst_cameraMatrix = Mat::eye(3, 3, CV_64F);
    Mat distCoeffs = Mat::zeros(4, 1, CV_64F);
    Size imageSize(1920*2,1080*2);
    Mat map_x, map_y;
    getCameraParams(cameraMatrix,dst_cameraMatrix,distCoeffs, "ft");
    fisheye::initUndistortRectifyMap(cameraMatrix, distCoeffs, Mat(),
                                         dst_cameraMatrix,imageSize, CV_32FC1, map_x, map_y);

    remap(Image, distortRectify, map_x, map_y, INTER_LINEAR);

    vector<vector<Point2f>> Rectify_contours;
    for(size_t i=0;i<contours.size();i++)
    {
        vector<Point2f> temp_vec;
        for(auto recitify_point : contours[i])
        {
            Point2f temp_point;
            float x,y;
            x = recitify_point.x;
            y = recitify_point.y;
            temp_point.x = map_x.at<float>(y,x);
            temp_point.y = map_y.at<float>(y,x);

            temp_vec.push_back(temp_point);
        }
        Rectify_contours.push_back(temp_vec);
    }
    for(size_t i =0; i<Rectify_contours.size();i++)
    {
        for(auto point: Rectify_contours[i])
        {
            circle( distortRectify, point, 3,  Scalar(0), 2, 8, 0 );
        }
    }

    imshow("distortRectify",distortRectify);
    waitKey();

I failed to get correct point position with above codes and I've focus on this problem for almost one day long. Anybody could help me? Any response will be appreciated!!!

Eunice TT
  • 49
  • 2
  • 7

1 Answers1

0

maybe you can use cv::fisheye::undistortPoints