Extracting bpp without explicitly mapping value to data types

asked 2016-03-02 05:15:07 -0600

Vaniax gravatar image


I need to calculate the bits per pixel of a matrix and wonder if there is a decent method to extract the depth of an image in bits directly without explicitly mapping the types CV_8U,.... to the appropriate values (or using if-else constructs)?

edit retag flag offensive close merge delete


  • cv::Mat has a depth() member, which gives you bytes per pixel.

  • "without explicitly mapping the types CV_8U" -- why would you do that ?

  • there can be float,double, or complex data inside. not every type is measurable in bits.

berak gravatar imageberak ( 2016-03-02 05:19:10 -0600 )edit