Ask Your Question
0

How to know the datatype of a input image?

asked 2014-02-01 05:26:04 -0600

user1234 gravatar image

I am reading an image from my computer and i want to know the datatype of that image. How can i do so?

The input image could be...CV_8UC1, CV_32FC1 or any other possibility.

Mat input = imread("sample.jpg", 1);
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-02-01 06:36:03 -0600

Nghia gravatar image

input.channels() for number of channels

input.type() is one of CV_8U, CV_32F, CV_64F ...

I'm hoping someone knows an easier way. input.type() just returns an int, which means you have to look it up. It would be nice if there's a version that outputs a string, for easier debugging.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-02-01 05:26:04 -0600

Seen: 754 times

Last updated: Feb 01 '14