Skip to content

Instantly share code, notes, and snippets.

🤣
My girl friend left me, so I started loving open source.

HEMANTH KUMAR THEFASHIONGEEK

🤣
My girl friend left me, so I started loving open source.
Block or report user

Report or block THEFASHIONGEEK

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Prewits_X.py
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]
]
View Prewits_y.py
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]
]
View Gabor_filter.py
# Gabor filter in x direction - Black to white gradient
#Theta - 0 degree
%matplotlib inline
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/chess_slant.jpg", 0);
pi = 3.14;
View Hessian_Filter.py
import numpy as np
import cv2
import skimage
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/sudoku.png", 0);
img = cv2.blur(img, (3, 3));
###################################FOCUS#######################################
robert_filter = skimage.filters.hessian(img, sigmas=range(1, 2, 1)) # Image binarization
View laplacian.py
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/sudoku.png", 0);
img = cv2.blur(img, (3, 3));
laplacian = cv2.Laplacian(img,cv2.CV_8UC1) #Binarized
f = plt.figure(figsize=(15,15))
f.add_subplot(1, 2, 1).set_title('Original Image');
plt.imshow(img, cmap = "gray")
f.add_subplot(1, 2, 2).set_title('Filtered Image');
View Otsu.py
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/text2.png", 0);
#img = cv2.blur(img, (3, 3));
# global thresholding
ret1,th1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)
View Adaptive_thresholding2.py
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/text.png", 0);
#img = cv2.blur(img, (3, 3))
# threshold -> 127
# maxval -> 255
# Output:
View Adaptive_thresholding1.py
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/text2.png", 0);
#img = cv2.blur(img, (3, 3))
# threshold -> 127
# maxval -> 255
# Output:
View Adaptive_thresholding.py
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/sudoku.png", 0);
img = cv2.blur(img, (3, 3));
#############################FOCUS################################################
ret,thresh1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)
thresh2 = cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY,11,2)
View simple_thresholding.py
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread("imgs/chapter5/sudoku.png", 0);
img = cv2.blur(img, (3, 3));
# threshold -> 127
# maxval -> 255
# Output:
You can’t perform that action at this time.