How to get bit depth of original jpg image

asked 2015-07-30 11:08:17 -0500

essamzaky gravatar image

I have 32 bit per pixle jpg image i used the following vode to read the image

int Ret = 0;
    //read the input image
    Mat orgMat = cv::imread(strInputFile,CV_LOAD_IMAGE_UNCHANGED );     

    if( orgMat.empty() )
        return ERROR_READ_FILE;     
    int iChannelsNum = orgMat.channels();
    int iImageType = orgMat.type();
    int iImageDepth = orgMat.depth();

How i can find the value which tell me the original bit depth of the image which 32 bpp
the return values are
iChannelsNum = 3
iImageType  = 16
iImageDepth  = 0
and the same return values when i read 24 bpp
so how i can know that the original image is 32 bpp ?
edit retag flag offensive close merge delete


"I have 32 bit per pixle jpg image" - hmm, that would be the 1st 32bit jpg image i've ever seen. to my knowledge, jpg images are either 8bit one chan, or 24bit 3chan.

some image viewers convert anything to 32bit internally, when loading, this might have fooled you.

berak gravatar imageberak ( 2015-07-31 00:06:30 -0500 )edit

Hi @berak , there are some other bpp used in image decoding sush as 1 bbp , which give the lowest image size , also i had heard about 4 ,16 , 32 , 48 bpp , Open CV can read them but i can not get the original bpp it seem it's converted by default to 8 bpp 1 channel or 24 bit 3 channel

essamzaky gravatar imageessamzaky ( 2015-07-31 12:00:15 -0500 )edit