How to find the Bit Depth of an image

这一生的挚爱 提交于 2020-01-30 08:42:05

问题


I am trying to get the Statistics of image like width, height, bands, min, max, mean, stddev etc., I could find all of these but however i can't find the Bit Depth of an image. i could not find any function , is there a way for this ?


回答1:


"Color depth, also known as bit depth, is either the number of bits used to indicate the color of a single pixel, in a bitmapped image or video frame buffer, or the number of bits used for each color component of a single pixel." [0]

You can check it by checking the data-type. If you are getting a numpy array in python, you can check the data-type with my_array.dtype. You probably get either a uint8 (8 bit/ 1 byte per colour channel) or uint16 (16 bit / 2 bytes per colour channel) in rare cases. But most images are encoded in uint8.

[0] https://en.wikipedia.org/wiki/Color_depth



来源:https://stackoverflow.com/questions/31619140/how-to-find-the-bit-depth-of-an-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!