Using Raspberry Pi cameraboard for realtime acquisition in simulink

1 vue (au cours des 30 derniers jours)
Marco
Marco le 24 Mai 2014
Commenté : Marco le 11 Juin 2014
Hello,
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

Réponses (1)

Murat Belge
Murat Belge le 4 Juin 2014
Marco,
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 commentaire
Marco
Marco le 11 Juin 2014
Sorry for my delay. Yes you have understood. I am trying to do Real-time techniques for object tracking and so on.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Raspberry Pi Hardware dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by