Can I threshold this further if so how?

1 次查看(过去 30 天)
Hi I have this image:
is there anyway I could process this further so that I am only left with an image with only parts like this:
I have used this code to produce this so far:
I = imread('Scan4Loc1.png');
A = rgb2gray(I)
imshow(A)
J = filter2(fspecial('sobel'),A);
min_matrix = min(J(:))
max_matrix = max(J(:))
figure
imshow(J)
K = mat2gray(J);
min_image = min(K(:))
max_image = max(K(:))
figure
imshow(K)

回答(1 个)

Prajit T R
Prajit T R 2018-3-14
Hi Oliver. I think the im2bw function may be of help to you. I tried the following code with the image you had attached and it seems to be working fine. Of course, depending upon your use-case, you would have to manually try different values for the variable 'level' until you get it right. The value 0.515 seems to be appropriate for this particular image.
I = imread('image.png');
level=0.515
A = rgb2gray(I)
imshow(A)
BW = im2bw(I, level)
figure
imshow(BW)
Cheers

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by