[英]What is the best type of marker to detect with OpenCV and how can I find the 2D location near real-time on the iPhone?
我正在编写一个iPhone应用程序,以使用OpenCV来检测iPhone相机中某种预定义标记(仅一个)的2D位置。 最好的标记类型是什么? 圈? 广场? 颜色? 检测该标记的最快方法是什么? 另外,检测算法需要接近实时运行。
我已经尝试过openCV的圆圈检测,但是得到了1 fps(640x480图像):
Mat gray;
vector<Vec3f> circles;
CGPoint findLargestCircle(IplImage *image) {
Mat img(image);
cvtColor(img, gray, CV_BGR2GRAY);
// smooth it, otherwise a lot of false circles may be detected
GaussianBlur( gray, gray, cv::Size(9, 9), 2, 2 );
HoughCircles(gray, circles, CV_HOUGH_GRADIENT,
2, gray.rows/4, 200, 100 );
double radius=-1;
size_t ind;
for( size_t i = 0; i < circles.size(); i++ ) {
if(circles[i][2] > radius) {
radius = circles[i][2];
ind = i;
}
}
if(ind == -1) {
return CGPointMake(0, 0);
}else {
return CGPointMake(circles[ind][0], circles[ind][1]);
}
}
任何建议或代码都会有所帮助。
提前致谢。
也许您可以尝试一些特定的彩色标记,然后再考虑滤色。 另外,具有特定定向纹理的对象也是一个不错的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.