sim_cf
sim_cf copied to clipboard
Keep/Delete OpenCV dependency
Description
I was doing a full installation test to list dependencies for my project. It seems that the full OPENCV library is required. However the library usage seem quite small.
find_package(OpenCV REQUIRED)
Current usage
It seems to be used for scaling some measures, but given the TODO message, I'm not sure something is happening.
if (_sdf->HasElement("covarianceImage")) {
std::string image_name =
_sdf->GetElement("covarianceImage")->Get<std::string>();
covariance_image_ = cv::imread(image_name, CV_LOAD_IMAGE_GRAYSCALE);
if (covariance_image_.data == NULL)
gzerr << "loading covariance image " << image_name << " failed"
<< std::endl;
else
gzlog << "loading covariance image " << image_name << " successful"
<< std::endl;
}
// ...
// This gets called by the world update start event.
void
GazeboOdometryPlugin::OnUpdate(const common::UpdateInfo& _info)
{
// ...
int x =
static_cast<int>(std::floor(gazebo_pos_x / covariance_image_scale_)) +
width / 2;
int y =
static_cast<int>(std::floor(gazebo_pos_y / covariance_image_scale_)) +
height / 2;
if (x >= 0 && x < width && y >= 0 && y < height) {
uint8_t pixel_value = covariance_image_.at<uint8_t>(y, x);
if (pixel_value == 0) {
publish_odometry = false;
// TODO: covariance scaling, according to the intensity values could be
// implemented here.
}
}
// ...
}
Propositions
At least, this issue will remind you of this waiting TODO. :smile:
- If this is feature you actually use, would it be possible to define what opencv modules are required ?
- If this is a left-over, would you consider removing the dependency to openCV2 ? This will become increasingly difficult to satisfy.
hahaha yes OpenCV is no need here ! I had it because of some rotorS dependencies that I removed. I'm going to remove it in the next commit/push., after solving some of the other issue you pointed.