0

I am working on Closed/open eye-detection project using OpenCV libraries in Eclipse for android latest version. I retrieve a part of detected face and then save it in a Mat variable.

I am getting problem in how to display all the values( gray-scale pixel values). These are the methods I tried:

  • I found the System.out.println() don't work in Android.
  • I used Log.i() function to display all pixel values in two for-loops, but it is showing limited values, means I am not able to see starting values.
  • I tried Mat_Variable.dump() function to display all the values of Mat variable, but I am not able to see any the output.

How can I display all the values present in Mat_variable?

Plus, is there any way to see all the values of Mat variable in Matrix-format (because System.out.println() doesn't work, otherwise I could use System.out.println() to display values in Matrix-format)?

Shiva
  • 6,677
  • 4
  • 36
  • 61
Abhay Swami
  • 21
  • 1
  • 4

1 Answers1

2

What about writing the values to a file?

If that'd be a solution for you, you could try the following:

// Create access to the file
cv::FileStorage file("mat.yml", cv::FileStorage::WRITE);
cv::Mat myMat;

// Write myMat to file!
file << myMat;

If you're having troubles with write-permissions have a look at the answers over here


I'm very sorry to not have looked more closely at the tags you specified. There are two ways to proceed. The first way would be to write the Mat to a file by hand following this approach. The second approach is to use Android-NDK. As I am not familiar with Android-NDK I can just point out some code sample for you.

Community
  • 1
  • 1
pdresselhaus
  • 679
  • 14
  • 32
  • Sorry, but I am new in android-openCV. If I am not wrong you have given **Native code language c++** based solution. Can you please give me java based solution? Otherwise, can you tell me how to access the java based Mat_variable in c++ file? Thank you. – Abhay Swami Jun 17 '14 at 13:40