wg-perception / linemod

An OR pipeline based on LINE-MOD from OpenCV
47 stars 54 forks source link

Fixed input params for training #9

Closed nlyubova closed 9 years ago

albertodesouza commented 9 years ago

Great! Thank's. Alberto.

albertodesouza commented 9 years ago

I wonder if you know why the texture of the coke.obj model used in the Tutorials does not appear during training when I turn on LINEMOD_VIZ_IMG... Relevant code (for visualization):

#if LINEMOD_VIZ_IMG
// Display the rendered image
if (*visualize_)
{
  cv::namedWindow("Rendering");
  if (!image.empty()) {
  cv::imshow("Rendering", image);
  cv::waitKey(1);
  }
}
#endif

I would like to use texture (including color) to improve detection of some objects...

Alberto.

albertodesouza commented 9 years ago

In line 212 of linemod_train.cpp, addTemplate() might return -1. This turns the indexes of the poses of the templates saved in the database out of sync with the id of the detected objects. This typically shows up in rviz as not properly oriented object detections. To correct the problem I suggest changing this peace of code:

detector_->addTemplate(sources, "object1", mask);

// Also store the pose of each template
Rs_->push_back(cv::Mat(R));
Ts_->push_back(cv::Mat(T));
distances_->push_back(distance);
Ks_->push_back(cv::Mat(K));

to that one:

int template_in = detector_->addTemplate(sources, "object1", mask);
if (template_in == -1)
{
  // Delete the status
  for (size_t j = 0; j < status.str().size(); ++j)
    std::cout << '\b';
  continue;
}

// Also store the pose of each template
Rs_->push_back(cv::Mat(R));
Ts_->push_back(cv::Mat(T));
distances_->push_back(distance);
Ks_->push_back(cv::Mat(K));

Alberto.

vrabaud commented 9 years ago

@nlyubova any input on the comments ?

nlyubova commented 9 years ago

fixed in https://github.com/wg-perception/linemod/commit/cbf27432ff638eb73ecddfaf40b0e512decfaf60