简体   繁体   English

SIFT对象检测边界框

[英]SIFT object detection bounding box

I am trying to track object from video stream using SIFT algorithm. 我正在尝试使用SIFT算法从视频流中跟踪对象。 I want to detect the object and track it by drawing a rectangle surrounding it. 我想检测对象并通过在其周围绘制一个矩形来对其进行跟踪。 The problem is, the rectangle gets skewed and not accurately drawn most of the time . 问题是,矩形在大多数情况下会倾斜并且无法准确绘制 I am using the following code to draw the rectangle around the detected object ( videoImage is the frame from video stream). 我正在使用以下代码在检测到的对象周围绘制矩形( videoImage是视频流中的帧)。

line(videoImage, sceneCorners[0], sceneCorners[1], Scalar(255, 0, 0), 2);
line(videoImage, sceneCorners[1], sceneCorners[2], Scalar(255, 0, 0), 2);
line(videoImage, sceneCorners[2], sceneCorners[3], Scalar(255, 0, 0), 2);
line(videoImage, sceneCorners[3], sceneCorners[0], Scalar(255, 0, 0), 2);

I also tried the following code ( imgMatches is the image with only the good matches) 我也尝试了以下代码( imgMatches是仅具有良好匹配项的图像)

line(imgMatches, sceneCorners[0] + Point2f( object.cols, 0), sceneCorners[1] + Point2f( object.cols, 0), Scalar(0, 255, 0), 2);
line(imgMatches, sceneCorners[1] + Point2f( object.cols, 0), sceneCorners[2] + Point2f( object.cols, 0), Scalar(0, 255, 0), 2);
line(imgMatches, sceneCorners[2] + Point2f( object.cols, 0), sceneCorners[3] + Point2f( object.cols, 0), Scalar(0, 255, 0), 2);
line(imgMatches, sceneCorners[3] + Point2f( object.cols, 0), sceneCorners[0] + Point2f( object.cols, 0), Scalar(0, 255, 0), 2);

Both seems give the same result. 两者似乎给出相同的结果。 So, my question is, how do draw a rectangle bounding my tracked object which is consistent to the tracked object? 因此,我的问题是,如何绘制一个矩形来限制我的被跟踪对象并使其与被跟踪对象一致? By the way, I am using OpenCV (C++) with Visual Studio 2010 on Windows 7. 顺便说一句,我在Windows 7上将OpenCV(C ++)与Visual Studio 2010一起使用。

The problem is not drawing the rectangle, but detecting the object correctly. 问题不在于绘制矩形,而是正确地检测对象。 It is very common that detections in single images are noisy if you get only some keypoints, even if you filter them with RANSAC and a fundamental matrix or a homography. 即使仅获得一些关键点,即使使用RANSAC和基本矩阵或单应性进行过滤,也很常见在单个图像中检测到噪声。

If you want a more accurate rectangle around the object, you must write a better detection algorithm. 如果要在对象周围使用更准确的矩形,则必须编写更好的检测算法。 For example, you can try to look for more correspondences when you have a first hint of the position of the object in the image. 例如,当您初步了解图像中对象的位置时,可以尝试寻找更多的对应关系。

Maybe have a look at this question SIFT matches and recognition? 也许看看这个问题SIFT的比赛和认可? . It's about the same question. 这是关于同一问题。 The solution is a 4D hough space. 解决方案是4D hough空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM