Ask Your Question

Markxx's profile - activity

2017-01-16 13:56:41 -0600 received badge  Famous Question (source)
2016-07-15 19:07:27 -0600 received badge  Notable Question (source)
2016-04-08 06:13:40 -0600 received badge  Popular Question (source)
2015-05-25 19:30:23 -0600 commented question How to get the bit-depth of an image?

I managed to fix the problem using: CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR But now the problem is it won't recognize a 4 channel image (says '3'). If I use UNCHANGED flag then it crashes the program when loading a 4 channel image.

2015-05-25 09:14:24 -0600 commented question How to get the bit-depth of an image?

Why am I getting CV_8U?

Here is my code:

cv::Mat cvImage;
cvImage = cv::imread(fileAddress, CV_LOAD_IMAGE_COLOR);
int imgDepth = cvImage.depth();

I will try installing newer version and see if it still doesn't work.

2015-05-25 04:11:21 -0600 commented question How to get the bit-depth of an image?
2015-05-25 02:17:17 -0600 commented answer How to get the bit-depth of an image?

I still don't understand...

You say depth() returns the depth of an individual channel. I already understand that part, and then you say that my image 'seems to have depth of 16bits'. How can you derive an answer of 16bits per channel if the value being passed is CV_8U which according to the manual is 8bits per channel?

If CV_8U means '16bit with 4 channels', then how do I check for 8bit with 4 channels?

This is very non-intuitive to me, because to me CV_16U should be 16bit, and CV_8U should be 8bit. and even the manual says so, yet that's not how it's calculated???

I would really appreciate it if you could provide me the code to calculate the depth for one channel: eg:

int imgDepth = <code to get depth per channel> // equals 8 or 16
2015-05-24 20:06:43 -0600 commented question How to get the bit-depth of an image?

Sorry but I still don't understand. The documentation says depth() "Returns the depth of a matrix element" and "CV_8U - 8-bit unsigned integers ( 0..255 )" and "CV_16U - 16-bit unsigned integers ( 0..65535 )"

I already know all of this, and it's not working. I'm new to openCV and new to programming so I don't really know what to do...

2015-05-24 09:25:14 -0600 asked a question How to get the bit-depth of an image?

Hi everyone, I have a PNG file which is 16bt per channel (total 48bit), but when I check the bit-depth with openCV using depth() it keeps returning CV_8U (zero).

int imgDepth = cvImage.depth();

Can someone please provide me with a solution to this problem, or at least explain what I'm doing wrong?

Thanks in advance, Mark.