Closed xMutzelx closed 8 years ago
I got it! Here is my Code in linemod_detect.cpp in line 382:
/* Check every pixel of the image. CARE: rows cols world */
for(int i=0; i<depth_real_model_raw.cols; i++)
{
for(int j=0; j<depth_real_model_raw.rows;j++)
{
cv::Vec3f & pixel = depth_real_model_raw.at<cv::Vec3f>(j,i);
if(pixel[0]!=pixel[0] || pixel[1]!=pixel[1] || pixel[2]!=pixel[2])
std::cout<<"Pixel is not a number (NAN)"<<std::endl;
else if(pixel[2]<0.1||pixel[2]>1.0)
std::cout<<"Z-value is invalid"<<std::endl;
else
std::cout<<"This pixel contains valid data"<<std::endl;
}
}
std::cout<<"Match: "<<match.x<<" "<<match.y<<std::endl;
This x and y coordinates are inside the bounding box so you also have to translate them. Variable "match" contains the relevant informations (match.x and match.y). There are still some problems with this solution. If the model doesn't fit the real world object perfectly some informations are lost. For me it is enough information, but if there is a better solution please let me know.
@nlyubova , any opinion on that?
Hi community, after Linemod detected an object, I would like to read the exact coordinates of the detected object. Something like: P1(220/230) P2(221/230) ... I have found code that returns the bounding box of the detected object, but there are to many points that doesn't belong to the object. I tried to calculate the points with the R-matrix and T-matrix but I don't get it right. Can someone please explain me how I can calculate/get every point coordinate? Sorry if this is a stupid question, but I think those coordinates would be nice for everybody who tries to modify/improve LineMod. Thank you very much, I really appreciate it.
My output of every variable: