我尝试在二进制图像中获得一些白色像素,并将像素的坐标保存到矩阵2x1的数组中。像这样:
//x y
//2 3
//7 8
//13 16
//24 26
//78 103
//22 14
//16 18
我在android中使用opencv并在二进制图像中获取白色像素并保存像素到数组的协调处理。但我不知道如何将它保存到数组和opencv适合的数组(Matofpoint,MatofPoint2f,MatOfInt ...)
这是我的代码,但缺少
Size BinaryImage_size = BinaryImage.size();
double[] pixel_white = new double[0]; //just use 1 channel
MatOfFloat pointPositions = new MatOfFloat();
for(int i=0;i<BinaryImage.height;i++)
{
for(int j=0;jBinaryImage.width;j++)
{
pixel_white = BinaryImage.get(i,j);
if(pixel_white[0]>0)
{
// Maybe use it pointPositions.push_back(Point(i,j)); but it wrong
//which implementation i should here?
}
}
}