Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers.

How to send a binary image over USB

0 votes
I am writing a new module in OpenCV. For the most part it is working fine and has fantastic frame rates!

The mapping to launch my code is:

MJPG 320 240 15.0 YUYV 320 240 60.0

As part of this color and shape based tracking script, I generate a binary image through a threshold process. To accurately calibrate the code, I need to visualize the binary image. When I attempt this, I only get a black screen. I believe this is because JeVois can not handle sending a binary image in a MJPG STREAM over USB. Is this correct? Is there a way I can have the binary image displayed over USB?
asked Nov 14, 2017 in Programmer Questions by Billbo911 (410 points)

1 Answer

0 votes

I answered my own question. I had to convert the binary image with a bit of a hack, to color.

Even though the threholded binary image just has two values for each pixel, 0 and 255, I was able to use:

binOut=c2.cvtColor(binImage, cv2.COLOR_GRAY2BGR)

The resulting image can then be set with 

outframe.sendCvBGR(binOut)

answered Nov 16, 2017 by Billbo911 (410 points)
yes, that is great, or you could stream the GRAY image out by declaring a different videomapping:

GRAY 320 240 15.0 YUYV 320 240 15.0

(generally speaking, it is a good idea to match camera and USB frame rates unless you are indeed processing 4 camera frames for each frame you send out to USB)

and then outframe.sendCvGRAY(binOut)

and finally use a frame grabbing program (guvcview, etc) that can grab GRAY (Y800) video frames.
...