Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

So I managed to ultilize the cv::findNonZero() function, to get the coordinates of the white pixels.

cv::Mat A;  
std::vector<cv::Point> pixelCoordinates;
std::vector<int> xp, yp;
cv::findNonZero(A, pixelCoordinates);
for (size_t i = 0; i < pixelCoordinates.size(); i++)
{
     xp.push_back(pixelCoordinates[i].x);
     yp.push_back(pixelCoordinates[i].y);
}