Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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 (binMatwith 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?!

OpenCV Java: (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 (binMatwith 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?!

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 (binMatwith (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?!

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?!