Darknet: webcamera only shows blank screen and 0 fps

Created on 6 Oct 2017  ·  17Comments  ·  Source: AlexeyAB/darknet

I have a problem with webcamera
Whenever I enter this command darknet.exe detector demo data/voc.data yolo-voc.cfg yolo-voc.weights -c 0
It just shows me a blank screen, and the fps is 0.
image,video file, netcamera works fine.

CUDA 8.0 with cudnn
OpenCV 3.2.0
gtx 750 ti

All 17 comments

@elnasdgreat Can you see video from your web-camera using any of your own OpenCV application?

Might be a bug of C API of cvRetrieveFrame().
I also met this issue, and work around it by switching to C++ interface.

@vinjn
I have a same problem ,too.
Do you mean I need to change the filename "image.c" to "image.cpp" to solve this problem?

No, it requires change of API, not just filename extensions.
Check my local hack
https://github.com/jing-vision/darknet/blob/master/my_src/my_demo.cpp#L63-L70

@vinjn
Do you use opencv249 or opencv320?
I use opencv320 with your code and result like this
123

the code can run but it seems that it didn't catch the picture.

@vinjn
I know how to solve my problem.
I found that opencv only supports usb3.0 webcam
Thank you!

i have opencv v3.2.0 installed. tried it also on a laptop webcam and usb webcam. same result.

@elnasdgreat
Do you use the codes which @vinjn offer?
You need to copy all files from @vinjn's darknet.
both opencv320 and open249 are ok.

@NTNUelec @AlexeyAB

only supports usb3.0 webcam

Does the following explicitly mean that no USB 2.0 webcams are not supported in any way? When I start darknet detector demo [data] [cfg] [weight] (-c 0) it will open the following window:

device

When accepting it will go to Couldn't connect to webcam. :No error

  • CUDA 8.0
  • Compiled without cuDNN on compute=20, sm=21
  • Standard opencv 3.2 with attached .ddls
  • using video files works

@kbitr
Do you use the codes which @vinjn offer?
And you need to use the usb3.0 jack on computer although your camera is usb 2.0

@NTNUelec
No, I did not at the point of the above post. But now that I did, it doesn't work.

First, the include is wrong somehow, probably due to evolution of the algorithm (comparing the files), having fixed that, core.hpp header must be compiled as C++ appears at building. USB 3.0 Port at Mainboard doesn't change anything.

Maybe this issue is not related to mine.

UPDATE: Actually now using -c 0 will result in opening a black output window, FPS is at normal speed for my hardware, no objects detected. After a few iterations it will freeze.

@kbitr
Yes, I had the same problem if I used AlexeyAB's darknet and vinjn siad that it may be a bug of opencv.
You need to use @vinjn darknet https://github.com/jing-vision/darknet
and replace src/demo.c with my_src/my_demo.cpp in @vinjn darknet

@NTNUelec
Sure, I tried. You can see my problem with this in my above comment.

C1189 - core.hpp header must be compiled as C++ - core.hpp - Line 49

What am I missing?

kbitr
You need to change your compilier.
Goto C/C++ -> Advanced, and change Compile as to Compile as C++ Code (/TP)

@NTNUelec
Okay, that did the trick for that problem, thank you.

But now it kicks out 624 Errors, mainly:
C2440 - 'initializing': cannot convert from 'void *' to 'float *' or
C2440 - 'initializing': cannot convert from 'void *' to 'image *'
etc.

I am trying to replace the _my_demo.cpp_ in the latest _master_ of this repo.
The same will happen, when I also try to compile _jing-vision/darknet_.

Having the same issue here. Just a grey non responding window and 0 FPS in the command prompt.

Can @vinjn patch be used with the latest version of @AlexeyAB repo? The other one is rather old.
Also replace in what way, copy over the my_demo.cpp or copy it over and rename it to demo.c?

Was this page helpful?
0 / 5 - 0 ratings