Remove object from plot

2 views (last 30 days)
Alex Perrakis
Alex Perrakis on 12 Jan 2022
Commented: Image Analyst on 12 Jan 2022
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!

Accepted Answer

Image Analyst
Image Analyst on 12 Jan 2022
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 Comments
Alex Perrakis
Alex Perrakis on 12 Jan 2022
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 on 12 Jan 2022
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products


Release

R11.1

Community Treasure Hunt

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

Start Hunting!