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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:44:46+00:00 2026-06-04T12:44:46+00:00

I have 4 coplanar points in a video (or image) representing a quad (not

  • 0

I have 4 coplanar points in a video (or image) representing a quad (not necessarily a square or rectangle) and I would like to be able to display a virtual cube on top of them where the corners of the cube stand exactly on the corners of the video quad.

Since the points are coplanar I can compute the homography between the corners of a unit square (i.e. [0,0] [0,1] [1,0] [1,1]) and the video coordinates of the quad.

From this homography I should be able to compute a correct camera pose, i.e. [R|t] where R is a 3×3 rotation matrix and t is a 3×1 translation vector so that the virtual cube lies on the video quad.

I have read many solutions (some of them on SO) and tried implementing them but they seem to work only in some “simple” cases (like when the video quad is a square) but do not work in most cases.

Here are the methods I tried (most of them are based on the same principles, only the computation of the translation are slightly different). Let K be the intrinsics matrix from the camera and H be the homography. We compute:

A = K-1 * H

Let a1,a2,a3 be the column vectors of A and r1,r2,r3 the column vectors of the rotation matrix R.

r1 = a1 / ||a1||
r2 = a2 / ||a2||
r3 = r1 x r2
t = a3 / sqrt(||a1||*||a2||)

The issue is that this does not work in most cases. In order to check my results, I compared R and t with those obtained by OpenCV’s solvePnP method (using the following 3D points [0,0,0] [0,1,0] [1,0,0] [1,1,0]).

Since I display the cube in the same way, I noticed that in every case solvePnP provides correct results, while the pose obtained from the homography is mostly wrong.

In theory since my points are coplanar, it is possible to compute the pose from a homography but I couldn’t find the correct way to compute the pose from H.

Any insights on what I am doing wrong?

Edit after trying @Jav_Rock’s method

Hi Jav_Rock, thanks very much for your answer, I tried your approach (and many others as well) which seems to be more or less OK.
Nevertheless I still happen to have some issues when computing the pose based on 4 coplanar point. In order to check the results I compare with results from solvePnP (which will be much better due to the iterative reprojection error minimization approach).

Here is an example:

cube

  • Yellow cube: Solve PNP
  • Black Cube: Jav_Rock’s technique
  • Cyan (and Purple) cube(s): some other techniques given the exact same results

As you can see, the black cube is more or less OK but doesn’t seem well proportioned, although the vectors seem orthonormal.

EDIT2: I normalized v3 after computing it (in order to enforce orthonormality) and it seems to solve some problems as well.

  • 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-04T12:44:47+00:00Added an answer on June 4, 2026 at 12:44 pm

    If you have your Homography, you can calculate the camera pose with something like this:

    void cameraPoseFromHomography(const Mat& H, Mat& pose)
    {
        pose = Mat::eye(3, 4, CV_32FC1);      // 3x4 matrix, the camera pose
        float norm1 = (float)norm(H.col(0));  
        float norm2 = (float)norm(H.col(1));  
        float tnorm = (norm1 + norm2) / 2.0f; // Normalization value
    
        Mat p1 = H.col(0);       // Pointer to first column of H
        Mat p2 = pose.col(0);    // Pointer to first column of pose (empty)
    
        cv::normalize(p1, p2);   // Normalize the rotation, and copies the column to pose
    
        p1 = H.col(1);           // Pointer to second column of H
        p2 = pose.col(1);        // Pointer to second column of pose (empty)
    
        cv::normalize(p1, p2);   // Normalize the rotation and copies the column to pose
    
        p1 = pose.col(0);
        p2 = pose.col(1);
    
        Mat p3 = p1.cross(p2);   // Computes the cross-product of p1 and p2
        Mat c2 = pose.col(2);    // Pointer to third column of pose
        p3.copyTo(c2);       // Third column is the crossproduct of columns one and two
    
        pose.col(3) = H.col(2) / tnorm;  //vector t [R|t] is the last column of pose
    }
    

    This method works form me. Good luck.

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

Sidebar

Related Questions

I have a polygon soup of triangles that I would like to construct a
I have a very large point cloud (> 100000 points) that I'd like to
have not tested on windows. but in ubuntu when u disconnect from the network,
I'm going to have meshes with several coplanar polygons, all lying in a certain
have some headers like: HTTP/1.1 100 Continue HTTP/1.1 302 Found HTTP/1.1 200 OK HTTP/1.1
Have advancements in CPU design like dynamic instruction scheduling narrowed the performance gap between
Have you ever been frustrated by Visual Studio not re-evaluating certain watch expressions when
Have a large amount of HTML, but where I thought the bottleneck would be
Have a rails app that is supposed to display a list of products/managers. After
Have anyone used ZmqSocket.js successfully? I'd like to know how can it be used

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.