Can I threshold this further if so how?
1 view (last 30 days)
Show older comments
Hi I have this image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171170/image.png)
is there anyway I could process this further so that I am only left with an image with only parts like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171171/image.png)
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)
0 Comments
Answers (1)
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
0 Comments
See Also
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!