ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

convert pixel values to meters

asked 2017-04-18 08:38:38 -0600

zubair gravatar image

updated 2017-04-18 14:00:31 -0600

NEngelhard gravatar image

hello guys ,

this is how i am getting x and y from the blob, can anyone tell me how can i convert these posX and posY values in meters or centimeters ??

//Calculate the moments of the thresholded image
cv:: Moments oMoments = moments(img_mask);

double dM01 = oMoments.m01;
double dM10 = oMoments.m10;
double dArea = oMoments.m00;

int posX = dM10 / dArea;
int posY = dM01 / dArea;

std::cout<<"posx:"<<posX<<"posy:"<<posY<<std::endl;

please help !!

thanks all;

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
3

answered 2017-04-18 09:48:58 -0600

NEngelhard gravatar image

Without additional information, this is simply not possible. A pixel corresponds to a ray from an object to the camera center and the position of the object on this ray is not known. Do you have any additional information? Like the distance of the object to the camera? Do you have the intrinsic calibration values for the camera?

edit flag offensive delete link more

Comments

no i dont have it now,, i will post soon my camera calibration values though,,

zubair gravatar image zubair  ( 2017-04-18 11:04:31 -0600 )edit
2

The only way to get the world coordinates of an object with a monocular camera is if you know the intrinsic parameters of the camera, you know the geometry of the object and you can detect at least 3 known points of the object in the image.

Martin Peris gravatar image Martin Peris  ( 2017-04-18 18:34:34 -0600 )edit

i will post my camera intrinsics today

zubair gravatar image zubair  ( 2017-04-19 03:15:51 -0600 )edit

guys, soon after having my camera calibration values,, what next i need to do convert these values in meters or find the blob distance from the camera ??? thanks

zubair gravatar image zubair  ( 2017-04-19 04:46:08 -0600 )edit

so, i got it working guys,, closing this now,, with remark answer has been excepted because i dont have any other relevant option to select there

zubair gravatar image zubair  ( 2017-04-21 03:38:31 -0600 )edit
-1

answered 2017-04-19 05:46:51 -0600

zubair gravatar image

image description

this is my calibration result

edit flag offensive delete link more

Comments

3

please post this as an edited part of the question, users can get confused since this is not an answer....

ΦXocę 웃 Пepeúpa ツ gravatar image ΦXocę 웃 Пepeúpa ツ  ( 2017-04-19 06:04:54 -0600 )edit
1

And please do not post images of text. Or put it in an word-document, print it, scan it, run OCR on it and upload it.

NEngelhard gravatar image NEngelhard  ( 2017-04-19 06:42:34 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-04-18 08:38:38 -0600

Seen: 1,483 times

Last updated: Apr 19 '17