Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Create an image with 5 bits for each pixel

I have an image with which consists of 8 bits for each pixel, how I can create new picture that consists of 5 bits for each pixel using python and OpenCV?

I know that in an RGB image, each pixel is represented by three 8 bit numbers associated to the values for Red, Green, Blue respectively, but I can’t figure it out how I can create an image from 8 bits for each pixel to a new image with 5 bits of each pixel.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

even if you make it 5 bits for each pixel, it will still take up 1 byte, since that is generally the minimum amount of memory that can be assigned an address.

You can rescale the value of the pixels i.e. multiply every pixel value with 32/256 (or just divide by 8) if you want to generate a mapping value on 5 bit scale for your image.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading