0

Rosanswers logo

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;


Originally posted by zubair on ROS Answers with karma: 178 on 2017-04-18

Post score: 0

1 Answers1

0

Rosanswers logo

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?


Originally posted by NEngelhard with karma: 3519 on 2017-04-18

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by zubair on 2017-04-18:
no i dont have it now,, i will post soon my camera calibration values though,,

Comment by Martin Peris on 2017-04-18:
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.

Comment by zubair on 2017-04-19:
i will post my camera intrinsics today

Comment by zubair on 2017-04-19:
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

Comment by zubair on 2017-04-21:
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