Skip to content

Commit

Permalink
Fixed threshold application, but should switch to using map_io in ros2
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Duchesne committed Dec 11, 2024
1 parent 9dd84d9 commit 5185dd9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions flatland_server/src/layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,8 @@ Layer * Layer::MakeLayer(
"Failed to load " + Q(image_path.string()) + " in layer " + Q(names[0]));
}

cv::Mat bitmap;
map.convertTo(bitmap, CV_32FC1, 1.0 / 255.0);

return new Layer(
node, physics_world, cfr, names, color, origin, bitmap, occupied_thresh, resolution,
node, physics_world, cfr, names, color, origin, map, occupied_thresh, resolution,
properties);
}
} else { // If the layer has no static obstacles
Expand Down Expand Up @@ -230,7 +227,7 @@ void Layer::LoadFromBitmap(const cv::Mat & bitmap, double occupied_thresh, doubl

// thresholds the map, values between the occupied threshold and 1.0 are
// considered to be occupied
cv::inRange(bitmap, occupied_thresh, 1.0, obstacle_map);
cv::threshold(bitmap, obstacle_map, int(occupied_thresh*bitmap.depth()), int(255), cv::THRESH_BINARY);

// pad the top and bottom of the map each with an empty row (255=white). This
// helps to look at the transition from one row of pixel to another
Expand Down

0 comments on commit 5185dd9

Please sign in to comment.