Home > database >  Create an image with 5 bits for each pixel
Create an image with 5 bits for each pixel

Time:03-31

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.

CodePudding user response:

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.

  • Related