【发布时间】:2013-12-15 23:40:03
【问题描述】:
目前我正在使用 Android Opencv。我使用特征检测器和 FAST 方法在 240 x 320 图像上查找关键点。
//create a keypoint mat
MatOfKeyPoint keyPoints = new MatOfKeyPoint();
//create feature detector
FeatureDetector fd = FeatureDetector.create(FeatureDetector.FAST);
//detect feature points
fd.detect(image, keyPoints);
//return feature points
return keyPoints;
接下来我会在Matching后从KeyPoints中提取点:
DMatch[] matchesArray = matches.toArray();
Vector<Point> pointsVec1 = new Vector<Point>();
Vector<Point> pointsVec2 = new Vector<Point>();
for(int i = 0; i < matchesArray.length; i++)
{
pointsVec1.add(keyPoints1.toArray()[matchesArray[i].queryIdx].pt);
pointsVec2.add(keyPoints2.toArray()[matchesArray[i].trainIdx].pt);
}
points1.fromList(pointsVec1);
points2.fromList(pointsVec2);
稍后我尝试获取这些点的像素颜色,这样做:
Point[] pointsArray = points.toArray();
Vector<byte[]> colorVector = new Vector<byte[]>();
for(int i = 0; i< pointsArray.length; i++)
{
Point point = pointsArray[i];
byte[] color = new byte[4];
image.get((int) point.x, (int) point.y, color);
colorVector.add(color);
}
return colorVector;
我仍然想知道,因为图像边界外有点。比如我通过调试发现了这一点:(308.0, 16.0)。通过 240 x 340 图像,该点不在图像中。这些还有更多的Point。我已经检查了 featureExtractor 并且 Point 已经包含在那里。所以我得到 R = 0, G = 0, B = 0 的颜色。
所以我的问题是: 这个积分是从哪里来的? 我是自己过滤它们还是函数中有类似阈值解决方案的东西? 或者我必须切换 x 和 y 或更改 Points 的转换?
最后这是一个小问题,但我无法解释自己是从哪里来的!
非常感谢您的帮助!
【问题讨论】:
标签: java android image opencv image-size