Ask Your Question

Is there a way to display cv::Mat using __android_log_print()[SOLVED]

asked 2019-07-13 06:34:29 -0500

open_ranger gravatar image

updated 2019-07-15 21:46:59 -0500

supra56 gravatar image

I know you can display a cv::Mat using cout << Mat << endl;

But I am examing this on a android phone it can't handle cout; So is there a established way to send it through __android_log_print()? which is pretty much the same as printf().

Or do I need to write my own customised version of std::String Mat_to_Sting(cv::Mat)?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-07-15 14:29:36 -0500

open_ranger gravatar image


Mat mat=(Mat_<uchar>(5,5)<<0,0,1,0,0,  0,2,2,2,0,  3,3,3,3,3,  0,4,4,4,0,  0,0,5,0,0);
ostringstream mat_data;
mat_data<<cv::format(mat, cv::Formatter::FMT_NUMPY);
__android_log_print(ANDROID_LOG_DEBUG, "JNI","Mat is: \n %s",mat_data.str().c_str());
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-07-13 06:34:29 -0500

Seen: 107 times

Last updated: Jul 15 '19