How to determine the most accurate value of thresh holding 'level' used to segment very fine cracks in Matlab using the im2bw(I2,level) function ?

1 次查看(过去 30 天)
I am currently using 'im2bw(I2,level)' function in Matlab(see attached code below)for 3 different images. At the moment inbuilt Matlab Otsu's method 'graythresh(I)' gives poor result while setting level in im2bw(I2,level) by trial and error is too hectic.
How can I obtain the most correct value for 'level' to segment most/if not all of the very thin/fine cracks for each image (see attached images)? Can anyone help with how I can go about doing this for each image? 
..............................................
I=imread('L1.jpg');
figure,imshow(I)
I2=imcrop;%Crop image to contain only steel surface containing cracks
figure,imshow(I2)
title('Original grey Image')
%%Binarize
level = 0.7303; % thresh holding level by trial and error too hectic!!!
%level = graythresh(I);% Matlab in-built global thresh holding based on Otsu's method returns NOT SO GOOD
%VALUES FOR 'level' are obtained from this!!!  
binaryImage = im2bw(I2,level);
figure,imshow(binaryImage)
title('Binarized image')
..........................................................
Images:-
Kind regards. BB

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by