difference between image depth and channels

后端 未结 5 1338
失恋的感觉
失恋的感觉 2020-12-30 00:56

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

5条回答
  •  礼貌的吻别
    2020-12-30 01:29

    Take it this way.

    You have an image that has just a single pixel in it. The SIZE of the image is 1x1 pixels.

    • If this is a gray scale image, than only a SINGLE channel is required to represent the image. How? Because a gray image (assuming a 8-bit image) would have 8 bits that is 2 raised to the power 8 whjch is 256 different SHADES. From Black to White. Gray scale
    • Gray scale is generally the black and white image.
    • Now if the same single pixel image is made of colors, then we need three channels, namely Red,Green and Blue or RGB. When we mix the shades of these channels we get different colors.
    • Like, (255,255,255) is pure white in RGB and (0,0,0) is pure black
    • So now each channel will have shades from 0-255 that is 8-bits.
    • The resulting color image has a depth of 8-bits and number of channels being 3.
    • You can have more than 8 bits per channel, this increases the color ranges (shades)
    • For the 1x1 pixel image, the pixel color values will range from 0-255 per channel. That is [0 to 255 in R][0 to 255 in G][0 to 255 in B]

提交回复
热议问题