TransWikia.com

Having converted a grayscale image to binary using `im2bw()`, is the converse operation possible?

Signal Processing Asked by Lisa Chowdhury on October 24, 2021

I have converted a gray-scale image to binary using im2bw() now i wanna do the opposite. How can I do that in MATLAB?

2 Answers

You have converted a matrix of integers into a two-valued map. It is not exactly invertible in general. An analogy: I am thinking of a bunch of numbers. If I tell you they are odd or even, can you guess them? Probably not.

However, under some conditions (image is not arbitrary, bounds are known), approximated reconstructions might be possible.

An example comes from compressive sensing, see for instance: 1-Bit Compressive Sensing.

Answered by Laurent Duval on October 24, 2021

As you've stated the problem, you can't. Converting a grey-scale image to black and white (binary) you're comparing pixel values (0-256 for an 8-bit image) to a threshold (that you define) and giving each pixel a value of 1 if the pixel is above the threshold, and 0 if it's below the threshold. The binary image doesn't contain information about by how much the pixel value was above or below the threshold.

If you want to get the pixel values from the original image which are above the threshold, you can multiply the binary image and the original image. All the values in the original image below the threshold will be zeroed out when they are multiplied by the zeros in the binary image. All the pixel values above the threshold in the original value will be multiplied by one and will retain their original values.

Unfortunately, if you're given an arbitrary binary image with no information about the threshold used, or the original image, you cannot recover the original grey-scale values.

Hope this helps.

Answered by user51411 on October 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP