Azzera filtri
Azzera filtri

output image from simulink and matlab code are different ??

2 visualizzazioni (ultimi 30 giorni)
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 Commento
Ryan Livingston
Ryan Livingston il 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?

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Block Libraries in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by