Skip to content
Snippets Groups Projects
Commit edda254d authored by beuchatp's avatar beuchatp
Browse files

Small adjustments to make the ROS Image topics (from the Camera Capture and...

Small adjustments to make the ROS Image topics (from the Camera Capture and Aruco Detector nodes) compatible with the web_video_server node from the Robot Web Tools initiative.
parent 26d1dc5a
Branches
No related tags found
No related merge requests found
......@@ -13,6 +13,8 @@ find_package(catkin REQUIRED COMPONENTS
rospy
std_msgs
geometry_msgs
sensor_msgs
cv_bridge
genmsg
roslib
)
......@@ -88,6 +90,7 @@ generate_messages(
DEPENDENCIES
std_msgs
geometry_msgs
sensor_msgs
)
################################################
......@@ -127,7 +130,14 @@ generate_messages(
# )
catkin_package(
CATKIN_DEPENDS roscpp rospy std_msgs geometry_msgs roslib
CATKIN_DEPENDS
roscpp
rospy
std_msgs
geometry_msgs
sensor_msgs
cv_bridge
roslib
)
###########
......
<launch>
<!-- LAUNCH A WEB VIDEO SERVER NODE -->
<node
pkg = "web_video_server"
name = "web_video_server"
output = "screen"
type = "web_video_server"
>
<param name="port" type="int" value="8080"/>
<param name="server_threads" type="int" value="1"/>
<param name="ros_threads" type="int" value="3"/>
</node>
</launch>
......@@ -57,6 +57,8 @@
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>cv_bridge</build_depend>
<build_depend>genmsgs</build_depend>
<build_depend>roslib</build_depend>
......@@ -64,11 +66,15 @@
<build_export_depend>rospy</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<build_export_depend>geometry_msgs</build_export_depend>
<build_export_depend>sensor_msgs</build_export_depend>
<build_export_depend>cv_bridge</build_export_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>sensor_msgs</exec_depend>
<exec_depend>cv_bridge</exec_depend>
<exec_depend>roslib</exec_depend>
......
......@@ -67,7 +67,7 @@ import cv2
import cv2.aruco as aruco
# Package to convert between ROS and OpenCV Images
from cv_bridge import CvBridge
from cv_bridge import CvBridge, CvBridgeError
......@@ -94,7 +94,7 @@ SAVE_IMAGE_PATH = "~/saved_camera_images/"
SHOULD_SHOW_IMAGES = False
# > A flag for whether to publish the images captured
SHOULD_PUBLISH_CAMERA_IMAGES = False
SHOULD_PUBLISH_CAMERA_IMAGES = True
......@@ -366,12 +366,15 @@ class ArucoDetector:
# Display that no aruco markers were found
#rospy.loginfo("[ARUCO DETECTOR] No markers found in this image")
# Set the frame variable that is used for save/display/publish
current_frame_with_marker_outlines = current_frame_gray
current_frame_with_marker_outlines = current_frame
# Publish the camera frame
if (SHOULD_PUBLISH_CAMERA_IMAGES):
#rospy.loginfo("[ARUCO DETECTOR] Now publishing camera frame")
self.image_publisher.publish(self.cv_bridge.cv2_to_imgmsg(current_frame))
try:
self.image_publisher.publish(self.cv_bridge.cv2_to_imgmsg(current_frame_with_marker_outlines, "bgr8"))
except CvBridgeError as cv_bridge_err:
print(cv_bridge_err)
# Save the camera frame if requested
if (self.should_save_image):
......
......@@ -50,7 +50,7 @@ from sensor_msgs.msg import Image
import cv2
# Package to convert between ROS and OpenCV Images
from cv_bridge import CvBridge
from cv_bridge import CvBridge, CvBridgeError
......@@ -226,7 +226,10 @@ class CameraCapture:
if (return_flag == True):
# Publish the camera frame
rospy.loginfo("[CAMERA CAPTURE] Now publishing camera frame")
self.image_publisher.publish(self.cv_bridge.cv2_to_imgmsg(current_frame))
try:
self.image_publisher.publish(self.cv_bridge.cv2_to_imgmsg(current_frame, "bgr8"))
except CvBridgeError as cv_bridge_err:
print(cv_bridge_err)
if (SHOULD_SAVE_CHESSBOARD_IMAGES):
# Check if the camera frame contains a calibration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment