Needing to take the difference of the two images to get part C. I feel book maybe wrong in way it describes how to do it.

2 次查看(过去 30 天)
I have parts A and B working properly, verified by setting the 8th bit to 0 and returning a almost completely black image which would be MSB. I tried several ways to finding the difference between the two and always get a completely black and white grainy image. Please help I think the book is wrong because subtracting the two images just gives me ones and zeros when part C has grey elements.

回答(1 个)

Ankit Dutta
Ankit Dutta 2019-2-21
Setting the LSB to zero i.e.
bitset(y, 1, 0)
will simply round every pixel down to the nearest multiple of 2 (i.e. 2^0 which is 1 to 0). For example, 131 will go to 130. But if the pixel already had an LSB of 0, it's already an even number and won't change. So, if it's 140 it will stay 140.
So, when you subtract the original you will get 1's where there were odd valued pixels and zero where the pixels were even. Thus, the image is just 1's and 0's. However, I am not sure using which function they were able to get an image that looks grayscale as in the book.

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by