python cv2 blob detection seg fault 1

python cv2 blob detection seg fault

import cv2
import numpy as np;

params = cv2.SimpleBlobDetector_Params()

ver = (cv2.__version__).split('.')
if int(ver[0]) < 3 :
    detector = cv2.SimpleBlobDetector(params)
else : 
    detector = cv2.SimpleBlobDetector_create(params)

detector.empty() # <- now works
keypoints = detector.detect(image) # <- now works

Here is what the above code is Doing:
1. Create a SimpleBlobDetector_Params object.
2. Create a SimpleBlobDetector object.
3. Call the empty() method on the detector object.
4. Call the detect() method on the detector object.

The empty() method is a workaround for a bug in the OpenCV library.
The detect() method returns a list of keypoints.

Similar Posts