Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ported over cv model #37

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

ported over cv model #37

wants to merge 2 commits into from

Conversation

srihan-kotnana
Copy link

Package Name: cvmodel_package

Ported over python cv_model code to detect lighted up sections. We require a input.mp4, the path/name must be specified in video_publisher.cpp. An output.mp4 is generated, an example of which is below.

output.mp4

Copy link
Contributor

@azhangvo azhangvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the detection node should not simply output to video. it should take input from image_raw (which is already done) and output detections to a different topic (i.e. /detections).

@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.8)
project(cvmodel_package)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename the package to detection

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

including changing folder name, etc

target_compile_features(video_publisher PUBLIC c_std_99 cxx_std_17)

# Add cvmodel_node executable
add_executable(cvmodel_node src/cvmodel_node.cpp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to detection_node as well


Mat edges = applyCanny(frame);

frame = drawCenters(frame, "blue");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than just draw the centers, we should also publish the results to a different topic. implement this using detections2darray http://docs.ros.org/en/noetic/api/vision_msgs/html/msg/Detection2DArray.html, you only need to populate the position of the pose

last_frame_time = this->now();

} catch (cv_bridge::Exception &e) {
RCLCPP_ERROR(this->get_logger(), "cv_bridge exception: %s", e.what());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this supposed to catch for exactly?

int frame_height = frame.rows;
double fps = 120.0;

writer.open(output_video, VideoWriter::fourcc('X', 'V', 'I', 'D'), fps, Size(frame_width, frame_height));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add in a parameter for video writer. in the standard use case, we don't want to output to video

}
}

void check_for_inactivity() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally this won't be needed in the future and doesn't fit with ROS but I think it's fine for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants