Ask Your Question

How to print the type name but not the value?

asked 2017-11-07 21:05:36 -0500

yode gravatar image

updated 2017-11-07 21:06:11 -0500

Such as I have such code

Mat img = imread("blobn.png", 0);
cout << img.type();

The output is 0, But it is not my expectation. Is possible print the name CV_8UC1 instead of the value 0?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-11-08 03:01:52 -0500

VxW gravatar image

In C++

The only solution I've found was this: print types

In Java (but I'm not so familar with Java)

It seems to be easier: System.out.println(CvType.typeToString(yourMat)); see

edit flag offensive delete link more


Thanks anyway. :)

yode gravatar imageyode ( 2017-11-08 03:13:16 -0500 )edit

Question Tools

1 follower


Asked: 2017-11-07 21:05:36 -0500

Seen: 131 times

Last updated: Nov 08 '17