我想使用形态学过滤掉我的图像,这样我就可以拥有主图像,但是,我产生的图像是不兼容的类型。我应该如何使这两个图像类型相同来执行代码,或者我应该怎么做?
info = dicominfo('MR000025.dcm');
>> Z = dicomread(info);
>> I=imadjust(Z,stretchlim(Z),[0 1]);
>> figure, imshow(I)
>> background = imopen(I,strel('disk',10));
figure,imshow(background)
>>
>> background = imopen(I,strel('disk',15));
>> figure,imshow(background)
>> figure, surf(double(background(1:8:end,1:8:end))),zlim([0 255]);
set(gca,'ydir','reverse');
>> I2 = I - background;
figure, imshow(I2)
>> I3 = imadjust(I2);
figure, imshow(I3);
>> level = graythresh(I3);
bw = im2bw(I3,level);
bw = bwareaopen(bw, 50);
figure, imshow(bw)
>> I4 = I - bw;
figure, imshow(I4)
Error using -
Integers can only be combined with integers of
the same class, or scalar doubles.
>> i=im2uint8(I);
>> i4=i-bw;
Error using -
Integers can only be combined with integers of
the same class, or scalar doubles.
>> i2=gray2ind(bw);
>> i3=i-i2;
>> figure, imshow(i3)
>>