Remove object from plot

1 次查看(过去 30 天)
Hello People, i have following code
pic01=imread("1.tiff");
pic1=im2gray(pic01);
i=1;
boundaries=[];
for i=3:25:222;
pic050=im2gray( imread(i+".tiff") );
%pic50=im2gray(pic050);
newpicture=imsubtract(pic01,pic050);
%imshow(newpicture)
level = graythresh(newpicture);
level = 0.19;
newbinpic = imbinarize(newpicture,level);
%imshowpair(newpicture,newbinpic,'montage')
newbinpic2=bwpropfilt(newbinpic,'perimeter',1);
% imshowpair(newbinpic2,newpicture,'montage');
boundariesi = bwboundaries(newbinpic2,'noholes');
boundaries=[boundaries;boundariesi];
binaryImage = 0.6< newbinpic2 & newbinpic2<1;
end
%figure;
%imshow(pic01);
t = 0:1:2000; %setup time
clors= hsv(numel(t)); %create a color map of different color for each time
figure(1),clf,hold on
%hold on
t1=1;
for k=1:length(boundaries)
thisBoundary = boundaries{k};
x = thisBoundary(:,2);
y = thisBoundary(:,1);
plot(x,y,'color',clors(t1,:),'Linewidth',2);
t1 = t1+10;
end
axis off
grid off
Which takes a series of photos and creates this 'plot' out of it
My question is, does anyone maybe have an idea on how to remove the nozzle (this thing in middle) along with the tube it kinda ruins the plot i think. Thanks very much bois and girls!

采纳的回答

Image Analyst
Image Analyst 2022-1-12
Attach 3 or 4 of the images with paperclip icon. We ca't run your code without it. I have done this before where a tube is dripping a colored liquid onto a surface and we need to erase the tube. It's bit tricky especially if the stain grows out and then circles back around under the tube. You need an image with the tube (filled with liquid if it's transparent) but not with any stain on the surface yet. It mostly involves logical and morphological operations like convex hull, AND, OR, imfill(), etc.
  4 个评论
Alex Perrakis
Alex Perrakis 2022-1-12
Thank very much! You helped me a lot! May i ask you one more question? I tried to make that code you sent me into a loop and until one point in functioned really well, but the masked "stain" goes black for some reason, is this because of the threshold?
Image Analyst
Image Analyst 2022-1-12
Could be. Just check the masks every step of the way by calling imshow() and see where and why it goes all black.
Another thing you should do is a background correction because you have quite severe nonuniformities due to lighting or lens shading. You need to estimate the background and divide the test images by the background. See attached demo.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

产品


版本

R11.1

Community Treasure Hunt

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

Start Hunting!

Translated by