Skip to content

Instantly share code, notes, and snippets.

View THEFASHIONGEEK's full-sized avatar
❣️
open source

DayDreamer THEFASHIONGEEK

❣️
open source
View GitHub Profile
# Source: https://scikit-image.org/docs/dev/auto_examples/features_detection/plot_glcm.html
import matplotlib.pyplot as plt
from skimage.feature import greycomatrix, greycoprops
from skimage import data
PATCH_SIZE = 21
import numpy as np
from PIL import Image, ImageFilter
from matplotlib import pyplot as plt
img = Image.open("imgs/chapter5/indoor.jpg")
blurred = img.filter(ImageFilter.BLUR)
f = plt.figure(figsize=(15,15))
f.add_subplot(1, 2, 1).set_title('Original Image')
plt.imshow(img)
# Box blur using OpenCV with normalized kernel => Normal Blur
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/outdoor.jpg", -1)
# Used for even float type images
blurred_Normalized = np.uint8(cv2.boxFilter(img, cv2.CV_64F, ksize=(5, 5), normalize=True))
import numpy as np
import random
import cv2
from matplotlib import pyplot as plt
from PIL import Image, ImageFilter
def sp_noise(image,prob):
'''
Add salt and pepper noise to image
prob: Probability of the noise
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/indoor.jpg", 0)
kernel = [
[0, 1, 0],
[1, -4, 1],
[0, 1, 0]
]
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/sudoku.png", 0)
kernel = [
[1, 0, -1],
[1, 0, -1],
[1, 0, -1]
]
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/sudoku.png", 0)
kernel = [
[1, 1, 1],
[0, 0, 0],
[-1, -1, -1]
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter7/hist_eq.jpg", 0)
#################################FOCUS###########################
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
out = clahe.apply(img)
#################################################################
import numpy as np
from PIL import Image, ImageFilter
from matplotlib import pyplot as plt
img = Image.open("imgs/chapter7/rain.jpg")
####################################FOCUS###############################
output = img.filter(ImageFilter.FIND_EDGES);
########################################################################
import numpy as np
from PIL import Image, ImageFilter
from matplotlib import pyplot as plt
img = Image.open("imgs/chapter7/tessellate.png")
#######################################FOCUS############################################
output1 = img.filter(ImageFilter.EDGE_ENHANCE)
output2 = img.filter(ImageFilter.EDGE_ENHANCE_MORE)
########################################################################################