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.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Walter Roberson
le 19 Fév 2019
You are overwriting all of B in each iteration of the for i , for j loops.
Each iteration of for i, for j, you are setting bit #1 for all of y.
Réponses (1)
Ankit Dutta
le 21 Fév 2019
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.
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!