Azzera filtri
Azzera filtri

Bubble shape detection and creating of the mask

4 visualizzazioni (ultimi 30 giorni)
Dear Matlab community,
I am totally new in the image processing. Nevertheless, I need to define the bubble on image, create mask and apply the mask to the original image. If someone can help me or give any useful advice, I will be really thankful.
Issue: I have a set of images (2000 for example) at which the bubble is growing and I need to define the bubble shape at each image and apply it for the its original.
I guess that it may be really easy (or not), I just have no any idea. I've already read a number of articles which dedicated the processing issues, but still have not solved problem.
So, I attached original image and three images after some manipulations. It doesn't matter which image you can offer to process. Thanks in advance!
Original:
Processed_1:
Processed_2:
  5 Commenti
Aleksandr Bashkatov
Aleksandr Bashkatov il 17 Dic 2017
Thanks, I will try use imellipse. Actually, may be it would be better.
Thanks again!
Best regards, Aleksandr
Aleksandr Bashkatov
Aleksandr Bashkatov il 18 Dic 2017
Modificato: Aleksandr Bashkatov il 18 Dic 2017
Dear Image Analyst,
I am sorry for my stupid question again=) Now, I almost solved my problem by means of imellipse.
However, now I have one more question. Hopefully that I didn't waste your time.
My code which I used now:
srcFiles = dir('C:\path\*.tif');
OutVideoDir = 'C:\path\Out';
for i = 1 : length(srcFiles)
filename = strcat('C:\path\',srcFiles(i).name);
I = imread(filename);
figure;
imshow(I,[]);
h = imellipse(gca, [326 455 236 236]);
addNewPositionCallback(h,@(p) title(mat2str(p,3)));
fcn = makeConstrainToRectFcn('imellipse',get(gca,'XLim'),get(gca,'YLim'));
setPositionConstraintFcn(h,fcn);
k = imellipse(gca, [326 1255 236 236]);
l = imellipse(gca, [324 2060 236 236]);
m = imellipse(gca, [324 2860 236 236]);
%accepted_pos = wait(h)
BW1 = createMask(h);
BW2 = createMask(k);
BW3 = createMask(l);
BW4 = createMask(m);
BW = BW1+BW2+BW3+BW4;
BW = 1-BW;
% subplot(1,2,1), imshow(BW), title('Mask');
maskedImage=I .* cast(BW, class(I));
%subplot(1,2,2), imshow(maskedImage,[]), title('Masked image');
baseFileName = sprintf('%d.tif', i);
fullFileName = fullfile(OutVideoDir, baseFileName);
imwrite(maskedImage, fullFileName);
close
end
So, I need to process a number of images (the ellipse will growth - I will add function of the coordinate changing later). When I run the process - it works. But each time, the window with the image is opened, due to the "imshow(I,[]);". And it is really interfere the work on the PC. These windows with the image bar constantly "flickers". Can you maybe give an advice how to hide this process? Thanks in advance!
Best regards, Aleksandr

Accedi per commentare.

Risposta accettata

Image Analyst
Image Analyst il 18 Dic 2017
Get rid of this line of code:
figure;

Più risposte (0)

Categorie

Scopri di più su Convert Image Type 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