小编Car*_*dos的帖子

opencv中的SimpleBlobDetector没有检测到任何内容

我正在使用OpenCV 3.1使用SimpleBlobDetector进行一些blob检测,但我没有运气,也没有教程能够解决这个问题.我的环境是x64上的XCode.

我刚开始看这张图片: 在此输入图像描述

然后我把它变成了灰度: 在此输入图像描述

最后我把它变成二进制图像并对此进行blob检测: 在此输入图像描述

我已经包含了"iostream"和"opencv2/opencv.hpp".

using namespace cv;
using namespace std;

Mat img_rgb;
Mat img_gray;
Mat img_keypoints;    
Ptr<SimpleBlobDetector> detector = SimpleBlobDetector::create();

vector<KeyPoint> keypoints;

img_rgb = imread("summertriangle.jpg");

//Convert to greyscale
cvtColor(img_rgb, img_gray, CV_RGB2GRAY);

imshow("Grey Scale", img_gray);

// Start by creating the matrix that will allocate the new image
Mat img_bw(img_gray.size(), img_gray.type());

// Apply threshhold to convert into binary image and save to new matrix
threshold(img_gray, img_bw, 100, 255, THRESH_BINARY);

// Extract cordinates of blobs at their centroids, save to keypoints …
Run Code Online (Sandbox Code Playgroud)

c++ opencv blob

2
推荐指数
1
解决办法
4804
查看次数

标签 统计

blob ×1

c++ ×1

opencv ×1