Errors when converting point image to 3D coordinates

Typically: "How do I... ", "How can I... " questions
Post Reply
Javierrc99
Posts: 23
Joined: 08 May 2022, 18:34

Errors when converting point image to 3D coordinates

Post by Javierrc99 »

Hello, my problem is the following:
I am getting the image coordinates in pixels (u,v) and using the pinhole model and intrinsic camera parameters matrix, I reconstruct the 3D point corresponding to that point in the image. The matrix "K" would be:

w = 6.287 # mm sensor film size
h = 4.712 # mm
n_h = 676 # pix number of pixels of the image (resolution)
n_v = 506 # pix
f = 2.8 #mm

u0 = n_h/2
v0 = n_v/2
rho_x = (w)/n_h
rho_y = (h)/n_v
fx = f/rho_x
fy = f/rho_y
K = [fx, 0, u0; 0, fy, v0; 0, 0, 1]

and I do the typical calculations involving K^-1 etc.

However I configure the vision sensor in Coppelia like this:
I set the perspective angle: FOVy = 2*arctan(d/2f) with d = h
I set the resolution with n_h and n_v

I don't think you can set more parameters to a vision sensor. So I think I am including errors when assuming this intrinsic matrix for the Coppelia vision sensor.
For example for an object placed in {World}: x = 3; y = -2;
My reconstruction gives: x = 4.376; y = -2.95;
I need this 3D reconstruction to be more accurate, so is there a better way to impose this intrinsic matrix to the coppelia vision sensor? or any other way to reconstruct the 3D point from an image that might be more accurate.
Thanks again.

Javierrc99
Posts: 23
Joined: 08 May 2022, 18:34

Re: Errors when converting point image to 3D coordinates

Post by Javierrc99 »

I forgot to mention: the camera is placed in {world} x = 0; y = 0; z = 10
So no conversion should be made to the reconstruction I get

coppelia
Site Admin
Posts: 10396
Joined: 14 Dec 2012, 00:25

Re: Errors when converting point image to 3D coordinates

Post by coppelia »

Hello,

have a look at Models/components/sensors/Camera pixels to 3D positions.ttm which does exactly what you want, via two different calculation methods.

Cheers

Post Reply