blob detect
斑点检测
斑点:与周围区域存在颜色差异或灰度差异的区域
斑点检测的主要思路是检测出图像中比周围像素灰度大或者比周围区域灰度值小的区域
1.基于求导的微分方法
2.基于局部极值的分水岭算法,基于此OPENCV中提供simpleBlobDetector特征检测器1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#include<iostream>
#include<vector>
#include<opencv2\opencv.hpp>
using namespace cv;
int main() {
Mat im = imread("D:/learn/jiaopan/source/images/opencv3/blob.jpg",IMREAD_GRAYSCALE);
imshow("im", im);
Ptr<SimpleBlobDetector> detector = SimpleBlobDetector::create();
std::vector<KeyPoint> keypoints;
detector->detect(im, keypoints);
Mat im_with_keypoints;
drawKeypoints(im, keypoints, im_with_keypoints, Scalar(0, 255, 0), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
imshow("keypoints", im_with_keypoints);
waitKey(0);
return 0;
}
原图
灰度图
斑点检测图
版权声明:原创,转载请注明来源,否则律师函警告
blob detect
https://jiaopaner.github.io/2018/07/12/blob detect/