MATLAB Answers

0

How can I define two tones in a grayscale image

Asked by Stelios Fanourakis on 12 May 2019
Latest activity Commented on by Jan
on 19 May 2019
Accepted Answer by Jan
Hi
I have an ultrasound image with lots of gray tones. I want to threshold the image by defining two of its tones. The higher intensity (white tone) and the lowest intensity (darkest gray tone). All other tones in the middle should be eliminated.
How can I do this?
Thanks

  0 Comments

Sign in to comment.

1 Answer

Answer by Jan
on 17 May 2019
Edited by Jan
on 19 May 2019
 Accepted Answer

You cannot eliminate colors in a gray-scale image, but only set them to another value.
img(img > 67 & img < 128) = 0;
Here all gray scale values between 68 and 127 are set to 0.

  3 Comments

(+1) = Short and very efficient solution!
"Here all gray scale values between 64 and 127 are set to 0."
You mean values between 68 and 127 are set to 0
Jan
on 19 May 2019
@Stelios: Correct. This was a typo.

Sign in to comment.