HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

Board: Jetson TX1
Installed : OpenCV4Tegra (2.4.13)

I faced this issue while installing openpose and now with YOLO2.

Error I get :
HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Couldn’t connect to webcam.
: Bad file descriptor

I noticed others faced it as well. But I couldn’t find any solutions to it.

Does this mean I need to remove OpenCV4Tegra and compile OpenCV afresh?
Is there a simpler solution?

Hi ShaktiD,

You error seems a webcam issue but not sepcific to YOLO2. Could you tell how to reproduce this issue?

Yes. It has something to do with OpenCV and the image formats coming from the camera.

I wiped clean previous JetPack installations and then, I setup JetPack 3, and then installed darknet. It was compiled with OpenCv and CUDA enabled.
The make file changes related to arch were made.

I can test individual images just fine.

ShaktiD,

We could try to simplify this issue into Opencv + webcam issue.

What camera do you use? Do you know what pixel format is sent from camera?

Could you hit this error by using some simple samples?

It’s the default CSI camera that comes with the Jetson TX1 development board.

I can install the Jetson Inference and run it just ok.

Could you share the sample code you are running? The one that would hit error.

This is the library I installed.

And then I am trying this:

./darknet detector demo cfg/coco.data cfg/yolo.cfg yolo.weights

Please know.
Your help is very much appreciated.
My actual attempt was a bit mixed up but seeking help on such mix up is difficult.
So, I cleaned it up and have took the stock installation route.

I would suggest to update to opencv 3.x first to check this issue. In the beginning, I thought this was some error from camera, but turns out not.

No, it has something to do with OpenCV and formats it provides to the library.

Ok.
A very noob query here.
So, it’s ok to upgrade to OpenCV 3, it won’t impact other installations like visionworks etc?
Or I need to eliminate all of those as well?

Any question is welcome.

Yes, we don’t verify visionworks with non-opencv4tegra so it may have error for some case.

Ok.
So far, I have no use of Visionworks planned, so I will just go ahead and upgrade to OpenCV3.
Found one guide, Ubuntu 16.04 or 15.10 OpenCV 3.1 Installation Guide · intel/caffe Wiki · GitHub

Is this ok or any other you will recommend?

Thank you for all your help.

Removed previous opencv.

Followed this guide.
http://docs.opencv.org/master/d6/d15/tutorial_building_tegra_cuda.html

It built correctly.
( The ‘make test’ for OpenCV however succeeded only 66%. )

Rebuilt darknet.

Same issue.

Will try building openpose too and see how that one goes.

Hi,

Please try this section to see if v4l2 can get your sensor.

“Approaches for Validating and Testing the V4L2 Driver”.

Jetson Download Center | NVIDIA Developer L4T Jetson TX1 Driver Package 24.2.1

I can’t locate any such section titled “Approaches for Validating and Testing the V4L2 Driver”.

It is under
“Camera Software Development Solution”

Are we on the same page? Jetson Download Center | NVIDIA Developer

I don’t see such section there.

L4T Jetson TX1 Driver Package 24.2.1
->Camera Software Development Solution

Is this solved? I am having the same error in jetson tx2 when I want to run the YOLO from the webcam

Sorry for the late reply.

We figure out that this may be the pixel format issue from opneCV. As I know, opencv 3.2 only supports BGR and Gray.

Thus, please see what format is your webcam first.

v4l2-ctl -d /dev/video0 --list-formats