Well, I’ve tried to use the same code as step 5 (based on RaspiStill.c) and I’ve just added a loop to take many pictures as quick as possible (it’s called a movie isn’t-it ?). Result is not too bad, but we can surely do better starting with RaspiVid.c (but another story, next step).
This way is quite simple and I get around 8 FPS (still better than my USB-cam and its 2-3 FPS).
Compared to step 5, only linors changes : take a look on main function (around line 743) and in encoder_buffer_callback (around line 235).
File is here : http://raufast.org/download/camcv2.c
Note : filename changed, update your CMakeLists.txt file ! 😉
Pingback: OpenCV and Pi Camera Board ! | Think RPI
Hi, great tutorial!
There is a problem though … previous step works fine (displaying a picture), but this step is giving me a black image. Any ideas why?
same here, but i noticed when i ssh into the RPi from my mac and run ./camcv2 remotely, it becomes visible (still dark, but at least visible). Must be a processing issue. Perhaps allocating more RAM to that process.
Hi. Even I having trouble getting a black image. Even from ssh. Any idea how to get a neat image using this program?
Great tutorial – everything works so far. I had the same issue with dark images when using a high frame-rate. Try pointing the camera at something bright and see if that makes a difference. I think there’s a play-off between a high frame-rate and the brightness of a picture because the camera is taking pictures for a fraction of a second and the lens isn’t large enough to let much light in.
Either that or you left the blue plastic cover on…
Same problem here. In the first several images, brightness is good enough but it gets darker and darker. Any solutions?
For black images, change cvWaitKey(1) in cvWaitKey(500) and see if you get images. This will give more time to display image (every 500 ms). Then, you can decrease parameter of cvWaitKey to reach higher frame rates.
I changed the cvWaitKey () to values of 1, 100, 500 , 1000, 3000, but the image remains always black . Any idea for this?
i simply copied the contents of camcv2. c into camcv.c, changed the value of cvWaitKey(1) from 1 to 500 and compiled. It is not working, generating an error: mmal: main failed to create preview component
mmal: failed to run camera app. Please check for firmware updates
0 seconds for 0 frames: FPS = nantime=730000
(time) 730000 clicks (0.730000 seconds). nb Frames = 0. FPS =0.000000
eme, try to change the following line (inside the camcv2.c file):
else if (!raspipreview_create(&state.preview_parameters))
to:
else if (raspipreview_create(&state.preview_parameters) != MMAL_SUCCESS))
Thanks!
NOT if (raspipreview_create(&state.preview_parameters) != MMAL_SUCCESS))
BUT
if (raspipreview_create(&state.preview_parameters) != MMAL_SUCCESS)
I had a black image.
To solve it I added the delay (camcv.c) after the for loop (around line 744)
for (frame = 1;frame<=num_iterations; frame++)
{
if (state.timelapse)
vcos_sleep(state.timelapse);
else
vcos_sleep(state.timeout);