V4L2 Video Capture from Simulink Support Package for Raspberry Pi Hardware is not working, getting error image

3 views (last 30 days)
Hello everybody,
I've got the following hardware setup: Raspberry Pi 2 Model B with Raspbian GNU/Linux 7 (wheezy) is connected via ethernet cable to a laptop running Matlab R2015b. IP config is static. On my laptop running the command
mypi=raspi
mypi
is giving me the properties of my raspberry pi, that's why I guess the connection setup should be correct. However when I want to use V4L2 Video Capture from Simulink Support Package for Raspberry Pi to display a v4l2 device that is running on my raspberry I get the following image:
Here you can see the simulink model:
Furthermore I can successfully play the v4l2 device with VLC Player on my raspberry using the command
cvlc v4l2:///dev/video0
That's why I think the video stream cannot be corrupt.
Am I getting the error image in Matlab because there's something wrong with the colorspace or with the timing? I tried different sample times (1/30) with respect to the information when I'm running the command
v4l2-ctl d /dev/video0 --all
which is showing:
Driver Info (not using libv4l2):
Driver name : v4l2 loopback
Card type : Dummy video device (0x0000)
Bus info : platform:v4l2loopback-000
Driver version: 4.1.13
Capabilities : 0x85208003
Video Capture
Video Output
Video Memory-to-Memory
Read/Write
Streaming
Device Capabilities
Device Caps : 0x85208003
Video Capture
Video Output
Video Memory-to-Memory
Read/Write
Streaming
Device Capabilities
Priority: 0
Video input : 0 (loopback: ok)
Video output: 0 (loopback in)
Format Video Capture:
Width/Height : 80/60
Pixel Format : 'RGB3'
Field : None
Bytes per Line: 240
Size Image : 14400
Colorspace : SRGB
Custom Info : feedcafe
Format Video Output:
Width/Height : 80/60
Pixel Format : 'RGB3'
Field : None
Bytes per Line: 240
Size Image : 14400
Colorspace : SRGB
Custom Info : feedcafe
Streaming Parameters Video Capture:
Frames per second: 30.000 (30/1)
Read buffers : 8
Streaming Parameters Video Output:
Frames per second: 30.000 (30/1)
Write buffers : 8
User Controls
keep_format (bool) : default=0 value=0
sustain_framerate (bool) : default=0 value=0
timeout (int) : min=0 max=100000 step=1 default=0 value=0
timeout_image_io (bool) : default=0 value=0
Thank you very much in advance!
Best regards,
Ron

Answers (2)

supakit kriangkajorn
supakit kriangkajorn on 4 Jan 2017
Edited: supakit kriangkajorn on 4 Jan 2017
  1. please check you change the Simulation mode on the toolbar to External.
  2. setting the Model configuration parameters (ctrl+e)
select hardware implementation and change hardware board to pi

Walter Roberson
Walter Roberson on 4 Jan 2017
What error message?
The color bars are exactly what the block description says you will get during simulation. The block becomes meaningful when you deploy to hardware.

Community Treasure Hunt

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

Start Hunting!