Pas encore de compte ?
Testé sous Anaconda et Python 3.7
# Introduction to FAST (Features from Accelerated Segment Test) import cv2 import matplotlib.pyplot as plt import numpy as np # Load the image image = cv2.imread('Detection-de-coins-Originale-02.jpg') # Convert image to RGB image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # Convert image to gray scale gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY) # Display image and gray image fx, plots = plt.subplots(1, 2, figsize=(20,10)) plots[0].set_title("Orignal Image") plots[0].imshow(image) plots[1].set_title("Gray Image") plots[1].imshow(gray, cmap="gray") fast = cv2.FastFeatureDetector_create() # Detect keypoints with non max suppression keypoints_with_nonmax = fast.detect(gray, None) # Disable nonmaxSuppression fast.setNonmaxSuppression(False) # Detect keypoints without non max suppression keypoints_without_nonmax = fast.detect(gray, None) image_with_nonmax = np.copy(image) image_without_nonmax = np.copy(image) # Draw keypoints on top of the input image cv2.drawKeypoints(image, keypoints_with_nonmax, image_with_nonmax, color=(0,255,0), flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS) cv2.drawKeypoints(image, keypoints_without_nonmax, image_without_nonmax, color=(0,255,0), flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS) # Display image with and without non max suppression fx, plots = plt.subplots(1, 2, figsize=(20,10)) plots[0].set_title("With non max suppression") plots[0].imshow(image_with_nonmax) plots[1].set_title("Without non max suppression") plots[1].imshow(image_without_nonmax) # Print the number of keypoints detected in the training image print("Number of Keypoints Detected In The Image With Non Max Suppression: ", len(keypoints_with_nonmax)) # Print the number of keypoints detected in the query image print("Number of Keypoints Detected In The Image Without Non Max Suppression: ", len(keypoints_without_nonmax))
Introduction To Feature Detection And Matching - GitHub
Bienvenu, je m’appelle Eric Soupet et je suis l'administrateur du site elodees.com. elodees.com est un état de l'art de l'Intelligence Artificielle et se veut collaboratif, vous pouvez dès à présent proposer du contenu tels que des articles, des événements, des tutoriels, ... alors n'hésitez pas !
Crédit des images de la plate-forme : Pixabay - Pixabay License | Pexels - Pexels License