<jupyter_start><jupyter_text>The function cv2.drawKeypoints takes the following arguments:cv2.drawKeypoints(input image, keypoints, blank_output_array, color, flags)flags:cv2.DRAW_MATCHES_FLAGS_DEFAULTcv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTScv2.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMGcv2.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS<jupyter_code># Draw blobs on our image as red circles
blank = np.zeros((1,1)) 
blobs = cv2.drawKeypoints(image, keypoints, blank, (0,255,0),
                                      cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
fig = plt.figure(figsize=(10,8))
ax = fig.add_subplot(111)
ax.imshow(blobs)
text = "Total Number of Blobs: " + str(len(keypoints))
cv2.putText(blobs, text, (20, 550), cv2.FONT_HERSHEY_SIMPLEX, 1, (100, 0, 255), 4)
fig = plt.figure(figsize=(10,8))
ax = fig.add_subplot(111)
ax.imshow(blobs)
# Set our filtering parameters
# Initialize parameter settiing using cv2.SimpleBlobDetector
params = cv2.SimpleBlobDetector_Params()

# Set Area filtering parameters
params.filterByArea = True
params.minArea = 100

# Set Circularity filtering parameters
params.filterByCircularity = True 
params.minCircularity = 0.9

# Set Convexity filtering parameters
params.filterByConvexity = False
params.minConvexity = 0.2
    
# Set inertia filtering parameters
params.filterByInertia = True
params.minInertiaRatio = 0.01

# Create a detector with the parameters
detector = cv2.SimpleBlobDetector_create(params)
    
# Detect blobs
keypoints = detector.detect(image)

# Draw blobs on our image as red circles
blank = np.zeros((1,1)) 
blobs = cv2.drawKeypoints(image, keypoints, blank, (0,255,0),
                                      cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)

number_of_blobs = len(keypoints)
text = "Number of Circular Blobs: " + str(len(keypoints))
cv2.putText(blobs, text, (20, 550), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 100, 255), 4)


fig = plt.figure(figsize=(10,8))
ax = fig.add_subplot(111)
ax.imshow(blobs)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10336176618163573, 'fraction_numerical': 0.043652784746613146, 'mean_word_length': 5.192546583850931, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '517295', 'license': 'MIT', 'n_tokens_mistral': 822, 'n_tokens_neox': 728, 'n_words': 148, 'path': 'Machine-Vison/Basics of OpenCV/Blob_Filtering .ipynb', 'repo_name': 'ankit-kothari/Data-Science-Journey', 'size': '1993'}