memri
Posts: 2
Joined: Wed Jan 22, 2014 11:18 pm

RPi camera board using simulink

Thu Jan 23, 2014 5:47 pm

We have recently purchased the Raspberry Pi camera module and are having some difficulties. Camera shown here:
http://uk.rs-online.com/web/p/video-mod ... 4E4F4E4526

Firstly, camera isn’t USB, it connects to the CSI port with 15 pins, and therefore we can’t find a Simulink block that allows video input of this type. Secondly, we are unsure of what OS needs to be installed to enable the use of the camera, as we currently have Linux operating system to enable us to use Matlab/Simulink.

Does anyone have any advice on how to operate this camera using the interfaces we have?

Thanks!

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23709
Joined: Sat Jul 30, 2011 7:41 pm

Re: RPi camera board using simulink

Thu Jan 23, 2014 5:51 pm

That is the CSI-2 based Raspberry camera, it's definitely not USB!

The default Raspbian image has example programs raspistill and raspivid to use the camera, and there is now a V4l2 driver for the camera which I think may be your best option.

Check out whether your system can accept V4L2 as a camera driver, then the posts on here about using V4L2.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

towolf
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm

Re: RPi camera board using simulink

Fri Jan 24, 2014 7:56 pm

If you are trying to run Matlab on the Raspberry Pi you are going to have a bad time.

The only chance you have is to work off a network stream on another x86 box.

User avatar
jbeale
Posts: 3494
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: RPi camera board using simulink

Fri Jan 24, 2014 8:03 pm

If you want to work with images, I think one way is just capture the image (JPEG, PNG etc) and read it from the filesystem, without needing Matlab to talk directly to the camera. The R-Pi camera video can be presented as a network stream, which also avoids needing any specialized interface that knows about the particular camera.

murat_belge
Posts: 27
Joined: Fri Feb 14, 2014 6:18 pm

Re: RPi camera board using simulink

Fri Feb 14, 2014 6:33 pm

The Linux image that Simulink uses is nothing but the Raspbian Wheezy image that the foundation provides plus some required Linux packages to ensure compatibility with the Simulink. For example, ALSA Audio Capture block requires ALSA development libraries and these are pre-installed in the Raspian Wheezy image that comes with Simulink. Look at my post in "http://www.mathworks.com/matlabcentral/ ... i-hardware" for details of what additional Debian/Linux packages are installed on top of the standard Raspbian Wheezy image shipped by the foundation.

The latest release of the Raspbian Wheezy image has V4L2 drivers for the Camera Board. This means that you can use V4L2 Video Capture block to capture images from the Raspberry Pi Camera Board. To enable this, first upgrade your Raspbian:

sudo apt-get update
sudo apt-get dist-upgrade
sudo rpi-update
sudo reboot

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.

murat_belge
Posts: 27
Joined: Fri Feb 14, 2014 6:18 pm

Re: RPi camera board using simulink

Fri Mar 07, 2014 2:50 pm

MathWorks has just released a MATLAB support package for Raspberry Pi that supports pulling images out of Raspberry Pi Camera Board to a PC running MATLAB. This feature is supported in R2014a version of MATLAB. Here is the relevant link to MathWorks web site: http://www.mathworks.com/hardware-suppo ... atlab.html.

Return to “Camera board”