Using Raspberry Pi cameraboard for realtime acquisition in simulink
조회 수: 2(최근 30일)
표시 이전 댓글
I have seen that in new MAtlab (2014a) you can control raspberry pi cameraboard by class:
but it works by for loop and taking snapshots, and furthermore you must specify the duration of acquisition. I have red in this topic that you can set V4L2 block as default camera:
I have tried that but it has a lag as usb camera (I guess because there are however the Linux drivers).
So I have seen that it runs in real-time acquisition if I use Linux-shell commands like:
[status, message] = h.execute(['raspivid -o vid.h264 -t 20000']) %where 20000 is the duration of acquisition in msec
I thought that I can use above code in a 'MATLAB Function' block but I guess it is not supported by C/C++ code generation because I don't see it in the list of supported functions. Some suggestions to perform a rea-time acquisition with raspberryPi's cameraboard? Thanks
댓글 수: 0
Murat Belge 2014년 6월 4일
The MATLAB Support Package for Raspberry Pi includes support for real-time acquisition from Camera Board. You need to use the snapshot() methods of the cameraboard object in a loop. If you complete your image processing within frame capture time, usually 33ms, this method provides a low-latency way of capturing and analyzing images from Raspberry Pi camera. Take a look at the Green Ball Detection example included in the MATLAB Support Package for Raspberry Pi.
The command you are citing, raspivid -o vid.h264 -t 20000, just captures a 20 second video clip and saves it onto the SD card of the Raspberry Pi. You can then retrieve the video file in Simulink for online analysis. Since you cannot access the captured video while recording is in progress, I would not call this real-time acquisition.
What exactly you are trying to do with the Raspberry Pi Camera? Object tracking, face detection, etc.? I might offer better help if you detail your use case.
댓글 수: 1
Find more on Simulink Support Package for Raspberry Pi Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!