フィルターのクリア

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 回表示 (過去 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 件のコメント
Walter Roberson
Walter Roberson 2019 年 2 月 19 日
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.

サインインしてコメントする。

回答 (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 Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by