opencv blob检测


#include "stdafx.h"
#include
#include
#include
#include
#include "opencv2/imgproc/imgproc.hpp"
#include
#include "imgproc/imgproc.hpp"
using namespace cv;
using namespace std;


int main()
{
    string name = "原图";
    Mat qq = imread("D:\\test11.jpg");
    //imshow(name, qq);
    cvtColor(qq, qq, CV_RGB2GRAY);
    vectordetectKeyPoint;
    clock_t st, ed;
    st = clock();
    Mat keyPointImage1, keyPointImage2;
    SimpleBlobDetector::Params params;
    params.minArea = 6;
    params.maxArea = 50;
    params.filterByCircularity = true;
    Ptr sbd = SimpleBlobDetector::create(params);
    sbd->detect(qq, detectKeyPoint);
    drawKeypoints(qq, detectKeyPoint, keyPointImage1, Scalar(0, 0, 255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
    imshow("keyPoint image1", keyPointImage1);
    ed = clock();
    cout << st << "\n\r" << ed;
    waitKey(0);
    return 0;
}


    

你可能感兴趣的:(opencv blob检测)