Skip to content

Base image#1

Open
jTucker583 wants to merge 3 commits intomasterfrom
base_image
Open

Base image#1
jTucker583 wants to merge 3 commits intomasterfrom
base_image

Conversation

@jTucker583
Copy link
Collaborator

Merge base_image image class to master branch

@jTucker583 jTucker583 self-assigned this Dec 13, 2023
@@ -0,0 +1,104 @@
actionlib==1.12.1

Choose a reason for hiding this comment

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

Please remove all the ROS specific stuff from here and include only what is required for the imports in the files you created. You can add to the README that ROS version XYZ is required

# robot_vision_base

This repo contains the ROS implementation of YOLOv3. The output of the algorithm is a bounding box around the detected object.
This repository contains the classes for an image publisher and an image subscriber.

Choose a reason for hiding this comment

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

Please include the ROS and python versions required for using this repository. Correct me if I'm wrong, but I think it's:
ROS Noetic (Ubuntu 20.04)
Python 3.8+

def __init__(self, cameraport, topic='image_topic', publishrate=0):
self.publishrate = publishrate
rospy.init_node('image_publisher_node', anonymous=True) # init rosnode
self.publisher = rospy.Publisher(topic, Image, queue_size=10) # init topic to publish to

Choose a reason for hiding this comment

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

The message type (Image) an init parameter, can be defaulted to Image

self.bridge = CvBridge() # convert opencv image to ros image msg
self.cam_feed = cv2.VideoCapture(cameraport) # init device we capture from

def publish_image(self):

Choose a reason for hiding this comment

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

To support Abdoulaye, we can probably split the publishing process into two function:

  1. A function that reads an image from the camera and returns that image as an array and the ret value (maybe def read(self))
  2. A function that takes in an image array, converts it to a ROS Image, and publishes it (maybe def publish(self, data). Abdoulaye can override this method to do his image processing

# cv2.imshow("publisher",img) - testing, making sure the image is being recieved by the camera
# Rerun the publish image method
if (self.publishrate == 0): # publish images as fast as possible
rospy.spin()

Choose a reason for hiding this comment

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

I think you can probably remove the if--spin--else and replace with rospy.sleep(self.publishrate). rospy.spin() is a blocking call.

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