Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
load/use image in Simulink

Subject: load/use image in Simulink

From: Constantin

Date: 19 Oct, 2010 05:55:04

Message: 1 of 5

Hello,

i need to load a image from file in Simulink and i don't know how can i do this. I don't have the "Video and Image Processing Blockset". I tried the "From Workspace"-Block, the "From File" Block and the Constant-Block.
i have to implement an image-compression algorithm in Simulink, so i need an image for testing. I'm a real novice in matlab/simulink. I have implemented the predictor in matlab, and now i have to implement this code in simulink. So i need a picture for testing.

with best regards,
Sibianu

Subject: load/use image in Simulink

From: Thomas Vanaret

Date: 19 Oct, 2010 08:53:06

Message: 2 of 5

There is a Simulink demo that use a level 2 M S-Function which can load a movie.

Simulink demo model is "sldemo_msfcn_edge_detect.mdl"

M S-Function used by the first block of the model is "mlloadmovie.m". The function looks quite simple.

You can also find this demo from the Simulink Library Browser :
"User-Defined Function" > "S-Function Examples" > "M-file S-functions" > "Level-2 M-file S-functions" > "Image edge detection using Sobel filter"

Subject: load/use image in Simulink

From: Constantin

Date: 19 Oct, 2010 15:39:04

Message: 3 of 5

It's looking very good, i will try that tomorow.

Thank you very much

"Thomas Vanaret" <firstname.lastname@safran-engineering.com> wrote in message <i9jm9i$h8c$1@fred.mathworks.com>...
> There is a Simulink demo that use a level 2 M S-Function which can load a movie.
>
> Simulink demo model is "sldemo_msfcn_edge_detect.mdl"
>
> M S-Function used by the first block of the model is "mlloadmovie.m". The function looks quite simple.
>
> You can also find this demo from the Simulink Library Browser :
> "User-Defined Function" > "S-Function Examples" > "M-file S-functions" > "Level-2 M-file S-functions" > "Image edge detection using Sobel filter"

Subject: load/use image in Simulink

From: Constantin

Date: 22 Oct, 2010 10:48:03

Message: 4 of 5

Ok, i have looked at the exemple and i tried to modify it to load and show a single picture and not a video without any changes in the picture. I don't really understand the mlplaymovie-block. I don't know how can i take the picture from the InputPort of this block and how i can show this picture on the screen.

with best regards,
Constantin Sibianu

"Constantin " <sibiancn@studi.uni-stuttgart.de> wrote in message <i9ke2o$fk$1@fred.mathworks.com>...
> It's looking very good, i will try that tomorow.
>
> Thank you very much
>
> "Thomas Vanaret" <firstname.lastname@safran-engineering.com> wrote in message <i9jm9i$h8c$1@fred.mathworks.com>...
> > There is a Simulink demo that use a level 2 M S-Function which can load a movie.
> >
> > Simulink demo model is "sldemo_msfcn_edge_detect.mdl"
> >
> > M S-Function used by the first block of the model is "mlloadmovie.m". The function looks quite simple.
> >
> > You can also find this demo from the Simulink Library Browser :
> > "User-Defined Function" > "S-Function Examples" > "M-file S-functions" > "Level-2 M-file S-functions" > "Image edge detection using Sobel filter"

Subject: load/use image in Simulink

From: Constantin

Date: 22 Oct, 2010 15:57:03

Message: 5 of 5

i found out, that i make something wrong by sending the image from the first block to the second. In the first block i load the picture from file and put this on the outputPort:
  block.OutputPort(1).Data = source_image;

In debugger modus i try to read the Inputport of the second block in the command window of matlab.
>>block.InputPort(1).Data
The result is a matrix with the same Dimension like the source_image but only with zeros inside.
What is wrong? How can i send the image to the second block and how can i take this image from the inputport?
Sorry, but i'm a really beginner in Simulink. :(

with best regards,
Constantin


"Constantin " <sibiancn@studi.uni-stuttgart.de> wrote in message <i9rq53$gqd$1@fred.mathworks.com>...
> Ok, i have looked at the exemple and i tried to modify it to load and show a single picture and not a video without any changes in the picture. I don't really understand the mlplaymovie-block. I don't know how can i take the picture from the InputPort of this block and how i can show this picture on the screen.
>
> with best regards,
> Constantin Sibianu
>
> "Constantin " <sibiancn@studi.uni-stuttgart.de> wrote in message <i9ke2o$fk$1@fred.mathworks.com>...
> > It's looking very good, i will try that tomorow.
> >
> > Thank you very much
> >
> > "Thomas Vanaret" <firstname.lastname@safran-engineering.com> wrote in message <i9jm9i$h8c$1@fred.mathworks.com>...
> > > There is a Simulink demo that use a level 2 M S-Function which can load a movie.
> > >
> > > Simulink demo model is "sldemo_msfcn_edge_detect.mdl"
> > >
> > > M S-Function used by the first block of the model is "mlloadmovie.m". The function looks quite simple.
> > >
> > > You can also find this demo from the Simulink Library Browser :
> > > "User-Defined Function" > "S-Function Examples" > "M-file S-functions" > "Level-2 M-file S-functions" > "Image edge detection using Sobel filter"

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us