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

Phase2 (b): Perception for TurtleBot 4 Open CV and MediaPipe: 3D Objects #12

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

Conversation

sumedhreddy90
Copy link
Contributor

@sumedhreddy90 sumedhreddy90 commented Jul 25, 2022

[In Progress] [(TODO) Update Description]
Implementation of the 3D object detection using openCV and MediaPipe

3d_detection

@sumedhreddy90
Copy link
Contributor Author

sumedhreddy90 commented Jul 25, 2022

Progress:
--- setting object detection only for one class - Shoe---

ros2 run unit02_simulation_motion_planner tb4_3D_perception

Add Shoe objects in the gazebo world to detect shoes

Output:
3d_detection
shoe

Copy link
Collaborator

@kscottz kscottz left a comment

Choose a reason for hiding this comment

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

This is mostly acceptable but it would be great if we could remove the window / wait keycode and replace it with just publishing the results as new topic. Perhaps something like '\perception\blobs' and 'perception\objects'

You should get familiar with RVIZ and this RQT utility.

current_frame = self.bridge.imgmsg_to_cv2(frames_data)

# Poping each and every frame
cv2.imshow("TurtleBot4 Camera View", current_frame)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We really shouldn't do this. You should use RVIZ or RQT to view the image as a topic.

cv2.FONT_HERSHEY_SIMPLEX, 0.6, (255, 255, 255), 2)

else:
cv2.putText(process_frames, 'circle', (x_point, y_point),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Screams in math.

cv2.FONT_HERSHEY_SIMPLEX, 0.6, (255, 255, 255), 2)

# displaying the image after drawing contours
cv2.imshow('Turtlebot 4 Simple Object Detection', process_frames)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Like I said, I would publish this as a topic.

i = 0

# list for storing names of shapes
for contour in contours:
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're going to want to cap the number of contours you process here. You can get in a degenerate situation where you have a large number of "blobs". I would make that number a node parameter and only highlight the n-most largest blobs by area.


resized_image = cv2.resize(current_frame, (720, 480))

# Poping each and every frame
Copy link
Collaborator

Choose a reason for hiding this comment

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

See previous comment.

cv2.putText(image, f'FPS: {int(fps)}', (20,70), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0,255,0), 2)
# displaying the image after drawing contours
cv2.imshow('Turtlebot 4 Simple Object Detection', image)
cv2.waitKey(1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't do this. You shouldn't wait inside a node loop. Same goes for the other node. Just spit the data out to a topic.

@kscottz
Copy link
Collaborator

kscottz commented Aug 18, 2022

One thing I might add, it is a bit too late now, is that it would have been nice to output the detected objects as some sort of topic. The drawback here is that doing this well is a bit of a rabbit hole in terms of what the messages should look like.

@sumedhreddy90
Copy link
Contributor Author

Screenshot from 2022-08-19 17-55-23

Added new publishers for detected Image and detected Pose of the Object

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