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 8383763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:14:41+00:00 2026-06-09T17:14:41+00:00

I am trying to use OpenCV’s estimateAffine3D() function to get the affine transformation between

  • 0

I am trying to use OpenCV’s estimateAffine3D() function to get the affine transformation between two sets of coplanar points in 3D. If I hold one variable constant, I find there is a constant error in the translation component of that variable.

My test code is:

std::vector<cv::Point3f> first, second;
std::vector<uchar> inliers;
cv::Mat aff(3,4,CV_64F);

for (int i = 0; i <6; i++)
{
    first.push_back(cv::Point3f(i,i%3,1));
    second.push_back(cv::Point3f(i,i%3,1));
}

int ret = cv::estimateAffine3D(first, second, aff, inliers);
std::cout << aff << std::endl;

The output I expect is:

[1 0 0 0]  
[0 1 0 0]  
[0 0 1 0]

Edit: My expectation is incorrect. The matrix does not decompose into [R|t] for the case of constant z-coordinates.

but what I get (with some rounding for readability) is:

[1 0 0 0]  
[0 1 0 0]  
[0 0 0.5 0.5]

Is there a way to fix this behavior? Is there a function which does the same on sets of 2D points?

  • 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-06-09T17:14:43+00:00Added an answer on June 9, 2026 at 5:14 pm

    No matter how I run your code I get fine output. For example when I run it exactly as you posted it I get.

    [1,0,0 ,0]
    [0,1,0 ,0]
    [0,0,.5,.5]
    

    which is correct because the 4th element of a homogeneous coordinate is assumed to be 1. When I run it with 2 as the z value I get

    [1,0,0 ,0]
    [0,1,0 ,0]
    [0,0,.8,.4]
    

    which also works (.8*2+.4 = 2). Are you sure you didn’t just read aff(2,2) wrong?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use OpenCV 2.0 to take three points, which essentially make up
I am trying to use the Python opencv function Moments() on a grayscale image,
I am trying to use the function ROI in OpenCV to identify a contour,
I've been trying to use the OpenCV function: double pointPolygonTest(InputArray contour, Point2f pt, bool
I am trying to call OpenCV function MinAreaRect2 from within python. I use OpenCV
I am trying to use the people detection function in OpenCV: cv::HOGDescriptor hog; hog.setSVMDetector(cv::HOGDescriptor::getDefaultPeopleDetector());
I am trying to use OpenCV and Python to stitch together several hundred puzzle
I'm trying to use the new OpenCV 2.0 API in MS Visual C++ 2008
I'm really stuck trying to use java wrapper library for opencv's cvMatchTemplate. See this
I'm new to OpenCV and would like to use its Python binding. When trying

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.