Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between image depth and channels

Tags:

I am trying to learn opencv but its very confusing. Can someone know the difference between imagedepth and the no. of channels in an image. Suppose the image depth is 8 and no. of channels R,G,B is 3. Then , what does it signify, I am having difficulty visualizing the 3d structure

like image 230
leonidus Avatar asked Apr 11 '12 14:04

leonidus


2 Answers

The depth (or better color depth) is the number of bits used to represent a color value. I am not really into OpenCV, but a color depth of 8 usually means 8-bits per channel (so you have 256 color values - or better: shades of grey (see comment) - per channel - from 0 to 255) and 3 channels mean then one pixel value is composed of 3*8=24 bits.

However, this also depends on nomenclature. Usually you will say

"Color depth is 8-bits per channel"

but you also could say

"The color depth of the image is 32-bits"

and then mean 8 bits per RGBA channel or

"The image has a color depth of 24-bits"

and mean 8-bits per R,G and B channels.

Bottom-line: Documentation (or wording) has to be quite specific here ;-)

like image 70
cli_hlt Avatar answered Sep 25 '22 15:09

cli_hlt


According to OpenCV documentation, in OpenCV depth is defined as the bit-depth of an individual channel. So if you have 8 bit depth and 3 channels, it means you have 24 bits per image pixel

like image 32
CharlesB Avatar answered Sep 24 '22 15:09

CharlesB