4. OpenCV using raspivid
Now we'll use raspivid.
http://thinkrpi.wordpress.com/2013/05/22/opencvpi-cam-step-6-video/
I refer to this blog step6
4-1 Modify raspivid.c
Modify raspivid.c or click to link for download.
camcv_vid0.c
------------------------------raspivid.c--------------------------------------------------------------------------
We delete- all lines related to the preview component,
- all lines related to the encoder component.
- all lines related to inline command parsing and picture info…
We change :
- add the callback directly to the video_port (line 286)
- create and attach the pool (to get/send message) to the video port… (line 320)
- change format encoding to ENCODING_I420 in line (268) (instead of OPAQUE)
- add the callback directly to the video_port (line 286)
- create and attach the pool (to get/send message) to the video port… (line 320)
- change format encoding to ENCODING_I420 in line (268) (instead of OPAQUE)
---------------------------------------------------------------------------------------------------------------------
change name to camcv.c
mv camcv_vid0.c camcv.c
make
./camcv
./camcv
If you meet this error
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates
---------------------------------------------------------------------------------------------
mmal: Failed to run camera app. Please check for firmware updates
---------------------------------------------------------------------------------------------
change Line 489
nano camcv.c
--------------------------------------------------------------------------------------------------------------------------
else if (!raspipreview_create(&state.preview_parameters))
=>
else if ( (status = raspipreview_create(&state.preview_parameters)) != MMAL_SUCCESS)
--------------------------------------------------------------------------------------------------------------------------
Re cmake
very slowly but recoding vidio
If you change resolution
Modify Line 183
and
color<--> gray change
Line 124
color<--> gray change
Line 124
Reference my case.
- 320×240 color : FPS = 27,2
- 320×240 gray : FPS = 28,6
- 640×480 color : FPS = 8
- 640×480 gray : FPS = 17
No comments:
Post a Comment