yolo roi binary
This commit is contained in:
@@ -120,6 +120,7 @@ public:
|
||||
// Debug
|
||||
bool enable_debug = false;
|
||||
cv::Mat debug_img;
|
||||
cv::Mat debug_binary_img;
|
||||
|
||||
// Store ROI rectangles for debug drawing
|
||||
std::vector<cv::Rect> debug_rois_;
|
||||
|
||||
@@ -99,6 +99,7 @@ private:
|
||||
|
||||
// Image transport for debug
|
||||
image_transport::Publisher result_img_pub_;
|
||||
image_transport::Publisher binary_img_pub_;
|
||||
|
||||
// TF
|
||||
std::shared_ptr<tf2_ros::Buffer> tf2_buffer_;
|
||||
|
||||
@@ -71,6 +71,11 @@ std::vector<fyt::auto_aim::Armor> Detector::detect(const cv::Mat& input) {
|
||||
cv::Mat full_binary_img;
|
||||
cv::threshold(gray_img, full_binary_img, binary_thres, 255, cv::THRESH_BINARY);
|
||||
|
||||
// Store binary image for debug visualization
|
||||
if (enable_debug) {
|
||||
debug_binary_img = full_binary_img.clone();
|
||||
}
|
||||
|
||||
uint64_t current_frame = frame_counter_.fetch_add(1, std::memory_order_relaxed);
|
||||
|
||||
// Update YOLO objects based on mode
|
||||
|
||||
@@ -437,6 +437,12 @@ std::vector<fyt::auto_aim::Armor> ArmorYoloDetectorNode::detectArmors(
|
||||
// Publish result image
|
||||
result_img_pub_.publish(
|
||||
cv_bridge::CvImage(img_msg->header, "bgr8", detector_->debug_img).toImageMsg());
|
||||
|
||||
// Publish binary image if available
|
||||
if (!detector_->debug_binary_img.empty()) {
|
||||
binary_img_pub_.publish(
|
||||
cv_bridge::CvImage(img_msg->header, "mono8", detector_->debug_binary_img).toImageMsg());
|
||||
}
|
||||
}
|
||||
|
||||
if (debug_publish_ms != nullptr) {
|
||||
@@ -554,10 +560,12 @@ void ArmorYoloDetectorNode::setModeCallback(
|
||||
|
||||
void ArmorYoloDetectorNode::createDebugPublishers() {
|
||||
result_img_pub_ = image_transport::create_publisher(this, "armor_detector/result_img");
|
||||
binary_img_pub_ = image_transport::create_publisher(this, "armor_detector/binary_img");
|
||||
}
|
||||
|
||||
void ArmorYoloDetectorNode::destroyDebugPublishers() {
|
||||
result_img_pub_.shutdown();
|
||||
binary_img_pub_.shutdown();
|
||||
}
|
||||
|
||||
void ArmorYoloDetectorNode::refreshDebugPublishersIfNeeded() {
|
||||
|
||||
Reference in New Issue
Block a user