检测丢失的对象

时间:2013-06-09 16:19:24

标签: c++ image opencv image-processing artificial-intelligence

我想检测图像的缺失对象。这是情况

  1. 你有一个房间的形象。房间里有一个球。
  2. 你有同一房间的另一张照片(光线条件相似)。唯一的区别是球丢失了。
  3. 现在我需要opencv来比较这2张图片并找到遗漏的内容。
  4. 我知道这样做的第一步,那就是计算两个图像的直方图并进行比较。如果第二张图像中缺少某些内容,则直方图值将有所不同。

    现在,如何检测“球”缺失?使用模板匹配?

1 个答案:

答案 0 :(得分:3)

如评论中所述,您可以轻松地减去这2张图片。 IIRC Mat已经超负荷 - [负]运营商。因此只要imgs是sub = img1 - img2;个对象,cv::Mat就足够了。

关于blob,请查看OpenCV网站上的以下教程:

http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html

http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/hull/hull.html

http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html