output image from simulink and matlab code are different ??

2 次查看(过去 30 天)
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 个评论
Ryan Livingston
Ryan Livingston 2014-4-2
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?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Block Libraries 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by