1

I am working on jackal robot I am trying to do some computer vision work using webcam and jackal UGV. I want to install webcam, . How I can access it and how i can its topic get published.

Thanks in Advance.

i plugged the webcam in Jackal but i am not able to access it and also its topic is not being published.

I have written simple code.

import cv2
vid = cv2.VideoCapture(0)
while(True):
    _, frame = vid.read()
    cv2.imshow('frame', frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
vid.release()
cv2.destroyAllWindows()

And getting below output which shows no frame at input I guess.

[ WARN:0@0.005] global /io/opencv/modules/videoio/src/cap_v4l.cpp (902) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
Traceback (most recent call last):
  File "jcv2.py", line 5, in <module>
    cv2.imshow('frame', frame)
cv2.error: OpenCV(4.6.0) /io/opencv/modules/highgui/src/window.cpp:967: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'`
Bilal
  • 3,191
  • 4
  • 21
  • 49
  • you might try this [solution](https://stackoverflow.com/a/62639343) to find your camera index, plus you can read this [tutorial](http://wiki.ros.org/rospy_tutorials/Tutorials/WritingImagePublisherSubscriber) on how to publish images. – Bilal Dec 23 '22 at 01:35

0 Answers0