Pas encore de compte ?
Testé sous Anaconda et Python 3.7
import cv2 from matplotlib import pyplot as plt import matplotlib.image as mpimg # path to input image is specified and # image is loaded with imread command image_originale = cv2.imread('Region-based-segmentation.jpg') plt.imshow(image_originale) plt.axis('off') plt.show() # cv2.cvtColor is applied over the # image input with applied parameters # to convert the image in grayscale img_gray = cv2.cvtColor(image_originale, cv2.COLOR_BGR2GRAY) # applying different thresholding # techniques on the input image Adaptative_mean = cv2.adaptiveThreshold(img_gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY, 9, 15) plt.imshow(Adaptative_mean, 'gray') plt.axis('off') plt.show() mpimg.imsave('AdaptativeMeanThresholding.jpg', Adaptative_mean, cmap='gray') Adaptative_gaussian = cv2.adaptiveThreshold(img_gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 9, 15) plt.imshow(Adaptative_gaussian, 'gray') plt.axis('off') plt.show() mpimg.imsave('AdaptativeGaussianThresholding.jpg', Adaptative_gaussian, cmap='gray')
Adaptative Mean
Adaptative Gaussian
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