Hi
Is it possible in IM to extract the 8 bit planes within an 8bit image to individual .png images for analysis?
Bit plane extraction
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Bit plane extraction
Note simply or fast but it should be possible using the bit operations of -fx
Hmmm... Extract the upper most bitplane..
convert rose: -fx '(int(u*255)&128)/255' show:
convert rose: -fx '(int(u*255)&64)/255' show:
convert rose: -fx '(int(u*255)&32)/255' show:
If you want them brighter you can either adjust the division (return color value back to normailised 0 to 1 range)
or just use -auto-level to spread the values to maximum values.
Of course the less significant bitplanes looks more and more randomized.
Hmmm... Extract the upper most bitplane..
convert rose: -fx '(int(u*255)&128)/255' show:
convert rose: -fx '(int(u*255)&64)/255' show:
convert rose: -fx '(int(u*255)&32)/255' show:
If you want them brighter you can either adjust the division (return color value back to normailised 0 to 1 range)
or just use -auto-level to spread the values to maximum values.
Of course the less significant bitplanes looks more and more randomized.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Bit plane extraction
anthony, thank you again
Am I right in using 256,128,64,32,16,8,4,2 ? Stupid question using 256 gives me as error, I get a 256kb frame rather than 6mb, using 255 gives me what appears to be full image data, I'd expect to see regular gaps to the histogram on MSB, where data from the lower planes would be missing.
Should there be a 256 in the IM commands above or am I just not understanding.
Am I right in using 256,128,64,32,16,8,4,2 ? Stupid question using 256 gives me as error, I get a 256kb frame rather than 6mb, using 255 gives me what appears to be full image data, I'd expect to see regular gaps to the histogram on MSB, where data from the lower planes would be missing.
Should there be a 256 in the IM commands above or am I just not understanding.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Bit plane extraction
You need to remember that when normalized the value is 0.0 to 1.0 but when using interger (quantums) it is 0 to 255.
In other words 255 (2^n-1) should be the right value.
In other words 255 (2^n-1) should be the right value.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/