How to convert a grey-scale image into a reverse binary image

3 views (last 30 days)
cup.jpgI have images like the one shown above and I want to convert the image to a binary image where the black parts are white and the rest of the image is black. How would I approach solving this problem?

Accepted Answer

Walter Roberson
Walter Roberson on 13 Dec 2019
Rbin = YourImage <= 42;
  2 Comments
Walter Roberson
Walter Roberson on 15 Dec 2019
I assure you that it does work, with the exception of TIFF images that use IEEE floating point representation (these exist but are rare)

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 15 Dec 2019
Try this:
grayImage = 255 - grayImage; % Assuming your image is uint8. Use 65535 if it's uint16.

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!