Ask Your Question

Mahm00d's profile - activity

2017-05-12 17:56:05 -0600 received badge  Notable Question (source)
2015-10-27 06:30:15 -0600 received badge  Popular Question (source)
2013-08-11 09:11:45 -0600 commented answer OpenCV (Java): how to access coordinates returned by findNonZero()?

I know about the get() method. But the size of output matrix is the same as the input image (as needed by the findnonzero() method), so, I still don't know which of the 476,000 pixels are white!

If I'm going to check the color of all of them, what's the purpose of findnonzer()?

2013-08-10 01:26:20 -0600 received badge  Editor (source)
2013-08-10 01:02:04 -0600 received badge  Supporter (source)
2013-08-10 00:50:18 -0600 asked a question OpenCV (Java): how to access coordinates returned by findNonZero()?

In my android app, I am using findNonZero() to find and access white points in a binary image.

I get the image (called binMat with size: 595*800) as the input to the method and then I have:

...
Mat wLocMat = Mat.zeros(binMat.size(), binMat.channels()); 
Core.findNonZero(binMat, wLocMat);

The problem is: I don't know how to access the white points' coordinates stored inside the wLocMat!

When I log the wLocMat.toString(), I get this:

[ 476000*1*CV_32SC2, isCont=true, isSubmat=false, nativeObj=0x74abd920, dataAddr=0x75bac010 ]

So, how exactly can I access the coordinates stored in wLocMat?!