OpenCV: libdc1394 error: Failed to initialize libd

2019-02-02 12:04发布

问题:

I installed OpenCV correctly on Ubuntu 14.04. However, when I run: import cv2 I get this error message:

>>> import cv2
libdc1394 error: Failed to initialize libdc1394

I read the answers to this question (and the different links posted there such as this interesting but finally useless one for my case) but no solution worked for me. I have no such file /dev/raw1394. So I installed the library:

sudo apt-get install libdc1394-22-dev libdc1394-22 libdc1394-utils

But still get the same error.

Note that this answer is the only one that works for me, however I can not pick it because I need to use camera in my application.

How can I resolve this ?

回答1:

Maybe disabling the driver isn't the best solution, but so far this hasn't given me any problems and was the easiest way I found to solve the issue:

sudo ln /dev/null /dev/raw1394

Attention: It is not a permanent solution.



回答2:

I vaguely remember a similar problem I once had. It has something to do with user-level permission to firewire devices. You need to add a new udev rule. Create a file /etc/udev/rules.d/raw1394.rules and add the following line:

KERNEL=="raw1394", GROUP="video"

Details can be found here and here.