1

我需要计算阈值图像中白色斑点的数量。我正在数一个标记上的小方块。但是由于网络摄像头的图像质量很差,这些正方形不会显示为正方形。这就是我决定使用 Blob 检测的原因。这适用于增强现实应用程序。我的决定对吗?

相机放置在标记附近

在此处输入图像描述

相机远离标记

在此处输入图像描述

4

3 回答 3

3

cvFindContours功能呢?自从我使用它已经有一段时间了,但我认为您可以在找到的轮廓的 CvSeq 中进行迭代,并以您喜欢的方式使用它们。

我知道这是一个旧线程,但也许它可以帮助你!

于 2013-01-23T19:13:56.533 回答
2

How about using the cvBlobsLib. This detects connected regions which you should easily be able to count, and obtain further information such as their size.

于 2011-11-24T16:37:47.163 回答
1

我使用了 findContours 函数。这是一段代码:

    std::vector<std::vector<cv::Point> > contours;      

    cv::findContours(m, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
    for( unsigned int i = 0; i < contours.size(); i++ )
    { 
        if( contours[i].size() < 3  ) // at least a triangular area?
            continue;

        double area = cv::contourArea(Mat(contours[i]) );
        if ( (area > min * min) && ( area < max * max ) )
        {
           //... use or count blob
于 2014-08-13T09:16:20.253 回答