Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6944579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:19:30+00:00 2026-05-27T13:19:30+00:00

I use OpenCV to undestort set of points after camera calibration. The code follows.

  • 0

I use OpenCV to undestort set of points after camera calibration.
The code follows.

const int npoints = 2; // number of point specified 

// Points initialization. 
// Only 2 ponts in this example, in real code they are read from file.
float input_points[npoints][2] = {{0,0}, {2560, 1920}}; 

CvMat * src = cvCreateMat(1, npoints, CV_32FC2);
CvMat * dst = cvCreateMat(1, npoints, CV_32FC2);

// fill src matrix
float * src_ptr = (float*)src->data.ptr;
for (int pi = 0; pi < npoints; ++pi) {
    for (int ci = 0; ci < 2; ++ci) {
        *(src_ptr + pi * 2 + ci) = input_points[pi][ci];
    }
}

cvUndistortPoints(src, dst, &camera1, &distCoeffs1);

After the code above dst contains following numbers:

-8.82689655e-001 -7.05507338e-001 4.16228324e-001 3.04863811e-001

which are too small in comparison with numbers in src.

At the same time if I undistort image via the call:

cvUndistort2( srcImage, dstImage, &camera1, &dist_coeffs1 );

I receive good undistorted image which means that pixel coordinates are not modified so drastically in comparison with separate points.

How to obtain the same undistortion for specific points as for images?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:19:31+00:00Added an answer on May 27, 2026 at 1:19 pm

    The points should be “unnormalized” using camera matrix.

    More specifically, after call of cvUndistortPoints following transformation should be also added:

    double fx = CV_MAT_ELEM(camera1, double, 0, 0);
    double fy = CV_MAT_ELEM(camera1, double, 1, 1);
    double cx = CV_MAT_ELEM(camera1, double, 0, 2);
    double cy = CV_MAT_ELEM(camera1, double, 1, 2);
    
    float * dst_ptr = (float*)dst->data.ptr;
    for (int pi = 0; pi < npoints; ++pi) {
        float& px = *(dst_ptr + pi * 2);
        float& py = *(dst_ptr + pi * 2 + 1);
        // perform transformation. 
        // In fact this is equivalent to multiplication to camera matrix
        px = px * fx + cx;
        py = py * fy + cy;
    }
    

    More info on camera matrix at OpenCV ‘Camera Calibration and 3D Reconstruction’

    UPDATE:

    Following C++ function call should work as well:

    std::vector<cv::Point2f> inputDistortedPoints = ...
    std::vector<cv::Point2f> outputUndistortedPoints;
    cv::Mat cameraMatrix = ...
    cv::Mat distCoeffs = ...
    
    cv::undistortPoints(inputDistortedPoints, outputUndistortedPoints, cameraMatrix, distCoeffs, cv::noArray(), cameraMatrix);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to use OpenCV with a GigE Vision Ethernet Camera, but I couldn't
I'm trying to use OpenCV with Python and converting some C++ code. Anyway, if
I'm trying to use OpenCV to open a camera. This works fine when I
I'm trying to use OpenCV 2.0 to take three points, which essentially make up
I want to use OpenCV 2.4.0 native code in Android 2.3.3. For that, I
I'm trying to use OpenCV GpuMat but I'm getting an assert error, my code
I'm trying to use the new OpenCV 2.0 API in MS Visual C++ 2008
I'm new to OpenCV and would like to use its Python binding. When trying
I'm really stuck trying to use java wrapper library for opencv's cvMatchTemplate. See this
I build opencv 233 as a static lib, but when i use it in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.