【问题标题】:Is there a function in OpenCV that does same function as Matlab Vision.blobAnalysis()?OpenCV 中是否有与 Matlab Vision.blobAnalysis() 功能相同的函数?
【发布时间】:2015-11-12 21:23:07
【问题描述】:
我们的目标是无法运行 Matlab 的嵌入式系统上的 Linux。
我们有计算机视觉 Matlab 脚本原型,并希望将此功能 (Vision.blobAnalysis) 移植到嵌入式。
两种选择:使用 Matlab CODER 将 Matlab 计算机视觉功能移植到嵌入式,或在嵌入式系统上使用 openCV 重现功能。
【问题讨论】:
标签:
matlab
opencv
computer-vision
feature-detection
【解决方案1】:
尝试一个简单的斑点检测器:
using namespace cv;
// Read image
Mat im = imread( "blob.jpg", IMREAD_GRAYSCALE );
// Set up the detector with default parameters.
SimpleBlobDetector detector;
// Detect blobs.
std::vector<KeyPoint> keypoints;
detector.detect( im, keypoints);
// Draw detected blobs as red circles.
// DrawMatchesFlags::DRAW_RICH_KEYPOINTS flag ensures the size of the circle corresponds to the size of blob
Mat im_with_keypoints;
drawKeypoints( im, keypoints, im_with_keypoints, Scalar(0,0,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS );
// Show blobs
imshow("keypoints", im_with_keypoints );
waitKey(0);