Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
Because of un-manageable amounts of spam despite our use of CAPTCHAs, email authorization, and other tools, we have discontinued this forum (see the 700k+ registered users with validated email addresses at right?). Please email us any questions or post bug reports and feature requests on GitHub at https://github.com/jevois -- The content below remains available for future reference.

Anyone tried the camera with OpenCV ?

+1 vote
Anyone tried the camera with OpenCV ?

Got the camera working with guvcview, but not sure of steps to integrate into OpenCV..
asked Mar 22, 2017 in Programmer Questions by krosner (130 points)

2 Answers

+1 vote

the JeVois camera announces itself to your host computer just like any other webcam. So a V4L2 device gets created for it (/dev/video0 or such) when your host detects it.

To grab frames from it or any other USB camera in OpenCV, you would use the cv::VideoCapture class.

Or check out this tutorial for python.

answered Mar 22, 2017 by JeVois (46,580 points)
By the way, I just tested this, and video viewed this way fixes the macOS delay problem.
great, are you willing to share your code? Maybe put it up on github and we will link to it from our docs? Thanks!
I added it as an answer. I think I'll try and make a better version with some additional controls, and if that turns out I'll definitely put it on GitHub.
Thanks much!
+1 vote
Here's a quick script that works for me to view the output of JeVois with OpenCV. I tried using cam.set(...) to change the size and fps to get a different demo, but so far it only works for the intro, or whatever ends up mapped to the default. However, it will continue running if a separate program is run, so you can actually use ffplay or guvcview to set the resolution after starting the OpenCV viewer to select the program you want. You might have to remove the frame flipping after this.

(This was made for Python 3 and OpenCV 3.0)

This is the only way I've found to view output on macOS without a large delay.

(I didn't see a way to format it as code or attach a file, so here it is...)

import cv2
from time import sleep

cam = cv2.VideoCapture(1)  # Number selects camera, can also use file

while cv2.waitKey(1) != 27:  # Break on ESC press
    success, frame = cam.read()
    if success:
        cv2.imshow("Webcam", frame[:,::-1])  # Reverse left-to-right

cv2.destroyAllWindows()
cam.release()

sleep(.1)  # Prevent segfaults
answered Mar 31, 2017 by krs013 (190 points)
edited Mar 31, 2017 by krs013
...