No account yet ?
1 Grayscale
Tested in Anaconda and Python 3.7
import matplotlib.pyplot as plt import cv2 def showimage(myimage, figsize=[10,10]): if (myimage.ndim>2): #This only applies to RGB or RGBA images (e.g. not to Black and White images) myimage = myimage[:,:,::-1] #OpenCV follows BGR order, while matplotlib likely follows RGB order fig, ax = plt.subplots(figsize=figsize) ax.imshow(myimage, cmap = 'gray', interpolation = 'bicubic') plt.xticks([]), plt.yticks([]) # to hide tick values on X and Y axis plt.show() img = cv2.imread('pexels-ovan-62689.jpg') showimage(img) img = cv2.imread('pexels-ovan-62689.jpg',0) showimage(img)
2 Gaussian filter
Tested in Anaconda and Python 3.7
import numpy as np from scipy import stats import matplotlib.pyplot as plt ## generate the data and plot it for an ideal normal curve ## x-axis for the plot x_data = np.arange(-5, 5, 0.001) ## y-axis as the gaussian y_data = stats.norm.pdf(x_data, 0, 1) ## plot data plt.plot(x_data, y_data)
3 Laplacian of Gaussian
LoG
Marr-hildreth
Convert the image to grayscale.
Apply a Gaussian filter to the image.
Apply the Gaussian Laplacian on the image.
Determine the zero crossings of the result.
Welcome, my name is Eric Soupet and I am the administrator of the site elodees.com. elodees.com is a state of the art of Artificial Intelligence and aims to be collaborative, you can now offer content such as articles, events, tutorials, ... so don't hesitate !
Platform images credit : Pixabay - Pixabay License | Pexels - Pexels License