Filter löschen
Filter löschen

Low contrast image, ablated area extraction

2 Ansichten (letzte 30 Tage)
Hidde Pik
Hidde Pik am 26 Apr. 2021
Bearbeitet: Hidde Pik am 28 Apr. 2021
Hi,
With a laser I ablated a certain area from an ink sample. Not the entire layer is ablated. Therefore, the contrast of the hole with the surrounding area is low.
With image processing I would like to determine the area of the ablated hole. This information would be very valuable for my research.
Below you find the script with my attempts to solve this problem. please help.
Kind regards,
Hidde
clear all; close all; clc;
I = imread('400_2_300.jpg');
I = rgb2gray(I);
imh = imadjust(I);
J = medfilt2(imh);
se = strel('disk',25);
thfilter = imtophat(J,se);
adjust = imadjust(thfilter);
bin = im2bw(adjust,0.35);
fill = imfill(bin,'holes')
filt_bin = medfilt2(bin);
fill1 = imfill(filt_bin,'holes');
img_close = imclose(fill1 , strel('disk', 1));
%take complement to adhere to convention
imgbw = imcomplement(fill1) ;
%make bridges across small "leaks"
img_close = imclose(imgbw , strel('disk',5));
%find holes in resulting image
holes = ~img_close & imfill(img_close, 'holes');
%add back holes to original image
img_filled = imfill((imgbw | holes) , 'holes');
%optional additional filling
img_filled_closed = imclose(img_filled, strel('disk', 5)) ;
figure(1), clf(1), hold on
subplot(3,3,1)
imshow(I)
subplot(3,3,2)
imshow(imh)
subplot(3,3,3)
imshow(J)
subplot(3,3,4)
imshow(thfilter)
subplot(3,3,5)
imshow(adjust)
subplot(3,3,6)
imshow(bin)
subplot(3,3,7)
imshow(fill)
subplot(3,3,8)
imshow(fill1)
subplot(3,3,9)
imshow(img_filled_closed)
hold off
  4 Kommentare
Hidde Pik
Hidde Pik am 26 Apr. 2021
Unfortunately the spot is not always in the same place. I am willing to do it manually. It will be some work, since I have 92 images. However cropping takes about 5 seconds to do.
Hidde Pik
Hidde Pik am 28 Apr. 2021
Bearbeitet: Hidde Pik am 28 Apr. 2021
@Image AnalystI managed to crop all the images. However I didn't manage to extract the area of the ablated hole. I attached the Binary Image that I end up with. As you can see he still takes a lot of the surrounding as well.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by