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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:28:27+00:00 2026-06-16T02:28:27+00:00

for a project I need to compute the real world position and orientation of

  • 0

for a project I need to compute the real world position and orientation of a camera
with respect to a known object.
I have a set of photos, each displays a chessboard from different points of view.
Using CalibrateCamera and solvePnP I am able to reproject Points in 2d, to get a AR-thing.
So my situation is as such:

  • Intrinsic parameters are known

  • Distortioncoefficients are known

  • translation Vector and rotation Vector are known per photo.

I simply cannot figure out how to compute the position of the camera. My guess was:

  • invert translation vector. (=t’)

  • transform rotation vector to degree (seems to be radian) and invert

  • use rodriguez on rotation vector

  • compute RotationMatrix * t’

But the results are somehow totally off…
Basically I want to to compute a ray for each pixel in world coordinates.
If more informations on my problem are needed, I’d be glad to answer quickly.

I dont’ get it… somehow the rays are still off. This is my Code btw:

Mat image1CamPos = tvecs[0].clone(); //From calibrateCamera
Mat rot = rvecs[0].clone(); //From calibrateCamera
Rodrigues(rot, rot);
rot = rot.t();

//Position of Camera
Mat pos = rot * image1CamPos;

//Ray-Normal (( (double)mk[i][k].x) are known image-points)
float x = (( (double)mk[i][0].x) / fx) - (cx / fx);
float y = (( (double)mk[i][0].y) / fy) - (cy / fy);
float z = 1;
float mag = sqrt(x*x + y*y + z*z);
x /= mag;
y /= mag;
z /= mag;

Mat unit(3, 1, CV_64F);
unit.at<double>(0, 0) = x;
unit.at<double>(1, 0) = y;
unit.at<double>(2, 0) = z;

//Rotation of Ray
Mat rot = stof1 * unit;

But when plotting this, the rays are off :/

  • 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-16T02:28:29+00:00Added an answer on June 16, 2026 at 2:28 am

    The translation t (3×1 vector) and rotation R (3×3 matrix) of an object with respect to the camera equals the coordinate transformation from object into camera space, which is given by:

    v' = R * v  + t
    

    The inversion of the rotation matrix is simply the transposed:

    R^-1 = R^T
    

    Knowing this, you can easily resolve the transformation (first eq.) to v:

    v = R^T * v' - R^T * t
    

    This is the transformation from camera into object space, i.e., the position of the camera with respect to the object (rotation = R^T and translation = -R^T * t).

    You can simply get a 4×4 homogeneous transformation matrix from this:

    T = ( R^T  -R^T * t )
        (  0       1    )
    

    If you now have any point in camera coordinates, you can transform it into object coordiantes:

    p' = T * (x, y, z, 1)^T
    

    So, if you’d like to project a ray from a pixel with coordinates (a,b) (probably you will need to define the center of the image, i.e. the principal point as reported by CalibrateCamera, as (0,0)) — let that pixel be P = (a,b)^T. Its 3D coordinates in camera space are then P_3D = (a,b,0)^T. Let’s project a ray 100 pixel in positive z-direction, i.e. to the point Q_3D = (a,b,100)^T. All you need to do is transform both 3D coordinates into the object coordinate system using the transformation matrix T and you should be able to draw a line between both points in object space. However, make sure that you don’t confuse units: CalibrateCamera will report pixel values while your object coordinate system might be defined in, e.g., cm or mm.

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

Sidebar

Related Questions

In part of my project I need to compute orientation of a patch in
I'm beginning a computer vision project and I need to compute the horizontal and
The Junits I have in my project need to load property files from the
For one project, I need to compute matchs planning between several teams. Requirement: I've
I have a project where I need to construct a fair amount of configuration
In my C# Class Library project I have a method that needs to compute
I'm working on a project(PHP Based) in which I need to compute SHA1, I'm
my project need to read multiple web pages at a time(eg: for a particular
My project need to compare output(only urls) of google and yahoo for a particular
My android app project need to add a new function of saving the click

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.