Clear Filters
Clear Filters

Can I threshold this further if so how?

1 view (last 30 days)
Oliver Mashari
Oliver Mashari on 11 Mar 2018
Answered: Prajit T R on 14 Mar 2018
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)

Answers (1)

Prajit T R
Prajit T R on 14 Mar 2018
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

Categories

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

Community Treasure Hunt

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

Start Hunting!