Filter löschen
Filter löschen

output image from simulink and matlab code are different ??

2 Ansichten (letzte 30 Tage)
vijay sai
vijay sai am 1 Apr. 2014
Kommentiert: Ryan Livingston am 2 Apr. 2014
I have built a simulink model to do watershedding as apart of project. The output I get from the simulink function block is quite different from matlab code version of the same program. I am attaching the code I used for both matlab and simulink and their output images
>>
if true
% a=imread('medtest.png');
b=watershed(a);%%MATLAB CODE
d=imshow(b);
c=label2rgb(a);
figure
imshow(c);
end
if true%%WATERSHEDDING
% function y = fcn(u)
% #codegen
coder.extrinsic('watershed','imshow','label2rgb','image');
y=zeros(size(u));
y = double(watershed(u));
image(y);
end
if true %%LABEL2RGB CODE
% function z = fcn(u)
coder.extrinsic('imshow','label2rgb');
% z=0;
z=zeros(size(u,1),size(u,2),3);
z = double(label2rgb(u));
imshow(z)
end
  1 Kommentar
Ryan Livingston
Ryan Livingston am 2 Apr. 2014
Could you please describe the code a bit more? The top block is your code in MATLAB and the bottom two are in the Function Block, or is it something else?
Also, from the model shown, it appears that only the watershedding code is in the function block. Is that the case?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Block Libraries finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by