Simulink with Raspberry Pi Camera Capture
27 次查看(过去 30 天)
显示 更早的评论
Hi all,
As is documented here, http://www.mathworks.co.uk/help/simulink/raspberry-pi.html, simulink offers hardware functionality with the Pi, however there are no functions or examples for using the new pi cameras. Such as image capture, instead there is only support for webcam video capture.
Would using the camera be easy to implement without this support, or do I need to find another method other than simulink?
Thanks
0 个评论
采纳的回答
Murat Belge
2014-3-19
The Raspberry Pi camera is supported by the Simulink. The Raspberry Pi Simulink Block library has a block called "V4L2 Video Capture". This block can capture images from any camera that has a V4L2 driver. Raspberry Pi foundation has recently released a V4L2 driver for the pi camera. Hence this block is compatible with the Raspberry Pi camera. Also note that the new (R2014a) MATLAB Support Package for Raspberry Pi Hardware supports capturing images from the Raspberry Pi camera module directly from the MATLAB command line.
In order to use V4L2 Video Capture Simulink block with the Raspberry Pi camera module, follow the instructions below (step 1 & 2 below is needed only for R2013a/R2013b releases):
1. Upgrade your Raspbian image to the latest to get the official V4L2 driver for Camera Board:
# sudo apt-get update
# sudo apt-get dist-upgrade
# sudo rpi-update
2. Reboot
# sudo reboot
3. After reboot, execute the following command to load the V4L2 driver for the Raspberry Pi Camera:
# sudo modprobe bcm2835-v4l2
After this step, you should see a /dev/video0 device (check by "ls -al /dev/vid*") that corresponds to the Camera Board. Now use the V4L2 Video Capture Block to capture images from this video device.
Note that you need to perform step 3 above every time you reboot your board. You can incorporate the command in step 3 into "/etc/rc.local" to automatically load the V4L2 driver at boot time.
3 个评论
Jose
2014-9-12
Hi Chris,
You can put that line in rc.local before "exit 0" line:
[...]
su -c "sudo modprobe bcm2835-v4l2" pi
exit 0
更多回答(1 个)
Will
2014-3-19
1 个评论
Hamza Idris
2017-1-7
hey Murat! after the process you defined above. I have a code of matlab fcn taking snapshot using command image=snapshot(cam) let cam be camera function do i need to use this command now. please help..
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!