VirtualBox issues with USB-CAM and IMAGE-VIEW

asked 2019-11-10 17:02:18 -0500

mhyde64 gravatar image


I am currently practicing opencv with ROS. I run it in various VMs with VirtualBox on a Windows Host Machine. Right now I am having some sort of formatting issue when I try and run image-view or my opencv bridge subscriber node.

I am unable to upload images but the out put has static for the top 10th of the screen and the rest is a dull green color. My subscriber node looks like:


Run a WebCam Feed Using OpenCV

From the ROS course on Udemy:


import sys
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import cv2

bridge = CvBridge()

def imageCallback(imageData):
    Recieves the image sensor data and converts it to an
    OpenCV format using CV Bridge
    print 'Received Image'
    #Convert ROS Image into OpenCV Image
        cvImage = bridge.imgmsg_to_cv2(imageData, "bgr8")
    except CvBridgeError as error:
        print error
    #Now ROS can work directly weith OpenCV

    (rows, cols, channels) = cvImage.shape
    if cols > 200 and rows > 200:, (100, 100), 90, 255)
    cv2.putText(cvImage, "WebCam Activated with ROS + OpenCV",
                (10, 250), font, 1, (255, 255, 255), 2, cv2.LINE_AA)
    cv2.imshow("Image Window", cvImage)

def main(args):
    Main Function. Initializes the Subscriber Node for
    Image Processing
    rospy.init_node('image_converter', anonymous=True)
    imageSub = rospy.Subscriber("/usb_cam/image_raw", Image, imageCallback)
    except KeyboardInterrupt:
        print "Shutting Down ... "


if __name__ == '__main__':

I run:

rosrun usb_cam usb_cam_node _pixel_format:=yuvu
rosrun mypkg

I have tried in both melodic on ubuntu 18 and kinetic on ubuntu 16 with the same results. I also run into the same error when i simply run

rosrun image_view image_view

I read that someone switch from VMWare to Parallels and it fixed their issue...but I would like to keep working with VirtualBox.

Any Suggestions?

edit retag flag offensive close merge delete


I'm in the same problem. If you fixed that error, could u tell me how to get through it

quyetbui gravatar image quyetbui  ( 2021-08-04 04:12:11 -0500 )edit

Try it on a raspberry pi instead

mhyde64 gravatar image mhyde64  ( 2021-08-04 06:17:25 -0500 )edit