Object of abstract class type "cv::SimpleBlobDetector" is not allowed

Trying to declare a SimpleBlobDetector in c++, I get the following error in Visual Studio 2022:

object of abstract class type “cv::SimpleBlobDetector” is not allowed

I’ve got OpenCV installed and libraries configured in VS2022, and am able to work with images and videos using OpenCV.

Minimal PoC:

#include <opencv2/features2d.hpp>

cv::SimpleBlobDetector detector;

int main() {
	// This will not build.
	return 0;
}
  • OpenCV 4.7.0-dev
  • Visual Studio 2022
  • x64
  • Debug / Release
  • Windows 11

call the SimpleBlobDetector::create() factory method

Thanks. :slight_smile:

#include <opencv2/features2d.hpp>

Ptr<SimpleBlobDetector> detector;

int main() {
	detector = SimpleBlobDetector::create();
	// This will build. Use detector->detect().
	return 0;
}

you’ll want a Params object too, to control that thing.