Ask Your Question
1

How can I get the raspberry Pi camera working with c++ on OpenCV3?

asked 2017-01-18 09:58:43 -0600

j0h gravatar image

I was pleased to read about the addition of ARM support in the Opencv 3 change log, and decided to try installing OpenCV3.2 on my raspberry Pi. The installation appears to have been a success, and works with a USB web camera as one might expect. When I try to use the raspberry Pi camera however, it is less intuitive.

I tried installing some separate APIs for supporting the raspberry pi camera, but this did not pan out. I have tested the camera using separate python libraries (piCamera), and it is operational.

Im not exclusively looking for an OpenCV3 support library, but if anyone has done this type of thing and knows a library that has C++ support for the Raspberry Pi Camera, and works with opencv3, I would like to know.

edit retag flag offensive close merge delete

Comments

Have you try google and this?

LBerger gravatar imageLBerger ( 2017-01-18 14:43:07 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2017-01-24 05:54:49 -0600

pklab gravatar image

To use the standard grabbing loop VideoCapture(0) with raspicam the Video4Linux driver is needed

On my website you can find an article about Install OpenCV-3.1 Python/C++ on Raspbian Jessie The article is for OpenCV 3.1.0 but the paragraph about Video4Linux should works

edit flag offensive delete link more
0

answered 2017-01-24 04:56:47 -0600

pi-null-mezon gravatar image

updated 2017-01-24 04:58:36 -0600

Ok, one of the simplest solution was:

1) You should install netcat on the raspberry:

cmd >> sudo apt get install netcat;

2) After that, you should open tcp video stream from the raspberry (first select desired PORT_NUMBER, f.t.i. 8080):

cmd >> while true; do raspivid -t 0 -n -w 1280 -h 720 -fps 48 -ex fixedfps -b 3000000 -vf -sa -100 -o - | nc -l PORT_NUMBER; done

3) Now, from your opencv application you can open this stream (first check your Rasberry ip address YOUR-RPI-IP-ADDRESS):

...
cv::VideoCapture _cv;
if(_cv.open("tcp://YOUR-RPI-IP-ADDRESS:PORT_NUMBER")) { // change MACRO to the actual values!
   // Yhoo!
} else {
   std::cerr << "Can not open video source!";
}
...
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-01-18 09:58:43 -0600

Seen: 6,391 times

Last updated: Jan 24 '17