简体   繁体   中英

Raspberry Pi Opencv-3.2.0 facedetect C++ sample can't find Raspberry Pi camera

-I have a 'Raspberry Pi 3'.

-Opereting System is 'RASPBIAN JESSIE WITH PIXEL'.

-My camera is 'Raspberry Pi Camera Module V2'.

This is Python Code which is works perfectly for Raspberry Pi camera:

from picamera import PiCamera
from time import sleep

camera = PiCamera()

camera.start_preview()
time.sleep(10)
camera.stop_preview()

So Raspberry Pi camera is working.

Opencv-3.2.0 facedetect C++ sample:

Source Code:

https://github.com/opencv/opencv/blob/master/samples/cpp/facedetect.cpp

For Compile:

sudo g++ -o facedetect facedetect.cpp pkg-config opencv --cflags --libs

For "./facedetect" Output is:

Capture from camera #0 didn't work

Detecting face(s) in

For "./facedetect 1" Output is:

Capture from camera #1 didn't work

Detecting face(s) in 1

So facedetect C++ sample can't find Raspberry Pi camera. How can I fix this?

Sudo modprobe bcm2835-v4l2 

如上所示为linux驱动程序加载视频

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM