MATLAB Answers

how to imshow(image,[]) in simulink

12 views (last 30 days)
vishnu
vishnu on 28 Jan 2020
Edited: vishnu on 5 Feb 2020
good afternoon everyone, please help me to solve this. i have a matlab code that run well and display matrix with imshow(image,[]) but it only shows black and white image in matrix viewer/ video viewer when i tried to transform it to matlab block in simulink. is there a way to display the image in simulink like using imshow(image,[]) in matlab. all images in attachtments. thanks for visiting this post.

  3 Comments

stozaki
stozaki on 28 Jan 2020
Do you use the 'Computer Vision Toolbox' ?
If you use the Computer Vision Toolbox, any sink block support image output and display on the Simulink canvas. Can you attach the image file you are importing to the figure?
I attached example model , but I don't know your input raw data.
Walter Roberson
Walter Roberson on 28 Jan 2020
Try using imagesc() and colormap(gray(256)) instead of imshow()
vishnu
vishnu on 29 Jan 2020
yes stozaki, im using it and it displays 'live image' of img1 very well but the matrix (img2) was generated from iteration (of pixels' intensity between 0 and 1 by 0.1) and was not imported from any figure. img3 is image(Ix) in matlab. thank you for the file but could you please export it to older version (im still using version 8.7 (R2016a))? i cant open it :-)

Sign in to comment.

Accepted Answer

stozaki
stozaki on 29 Jan 2020
Hello vishnu,
I attached model made by R2016a. Please edit some parameters as needed.
Regards,
stozaki
sampleimg.png

  4 Comments

Show 1 older comment
stozaki
stozaki on 29 Jan 2020
Can you open the model on the R2016a and solve this problem?
vishnu
vishnu on 30 Jan 2020
yes, thank you. i can open it by setting the sample time of the 'image from file' blocks into any number to display the image (im using R2016a and the default setting is inf) and best it can do 'thresholding' the image (no fft), but i still dont know why did the matlab function block that's connected to matrix/ image viewer in simulink displays different image when using matlab command window: image(img); :-)
stozaki
stozaki on 1 Feb 2020
MATLAB functions and Simulink blocks are not always completely equivalent. Processing content may be slightly different. In that case, the designer will need to make adjustments as needed.
Best Regards,
stozaki

Sign in to comment.

More Answers (1)

Selva Karna
Selva Karna on 28 Jan 2020
check image processing & computer vision toolbox ,

  0 Comments

Sign in to comment.

Sign in to answer this question.