フィルターのクリア

how can i remove bits from a 8 bit pixel ?

1 回表示 (過去 30 日間)
niranjan v
niranjan v 2019 年 1 月 7 日
コメント済み: Walter Roberson 2019 年 1 月 10 日
There is an 8 bit pixel and im considered as 5 bits of msb and 3 bits of lsb . so i want to remove 3 lsbs from the pixel. is it possible?

採用された回答

Walter Roberson
Walter Roberson 2019 年 1 月 7 日
No. In MATLAB all of the numeric datatypes , and char as well , are defined as being multiples of 8 bits long. It is not possible to remove 3 bits from any numeric datatype or from char.
The size of the datatype logical is not specified in MATLAB . On the other hand there is no documented mechanism for setting more than true or false for logical . There is evidence that logical is one byte and that it could be hacked to store additional values... but none of those hacks would permit removing 3 bits from a logical .
I recommend that instead of trying to remove bits from pixels that you extract bits instead . see bitget and bitset.
  2 件のコメント
niranjan v
niranjan v 2019 年 1 月 10 日
thank you sir for giving valuble information but i have to work on first 5 bits only and i dont need remaining 3 bits. is this possible sir?
Walter Roberson
Walter Roberson 2019 年 1 月 10 日
bitget can tell you the value of those bits.
or if the datatype is uint8 then divide the value by 8.

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by