import numpy as np
import cv2

# Loading image
image = cv2.imread("coins.jpg")
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
cv2.imshow("Blurred Image", blurred)

# Applying adaptive thresholding
meanThresh = cv2.adaptiveThreshold(blurred, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY_INV, 11, 4)
cv2.imshow("Mean Thresh", meanThresh)

gaussianThresh = cv2.adaptiveThreshold(blurred, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 15, 3)
cv2.imshow("Gaussian Thresh", gaussianThresh)

cv2.imshow("Comparison", np.hstack([blurred, meanThresh, gaussianThresh]))

cv2.waitKey(0)
23c95538ac9438eb6ff9e7381cccfeeac40c3d52
<mask token>

<mask token>
cv2.imshow('Blurred Image', blurred)
<mask token>
cv2.imshow('Mean Thresh', meanThresh)
<mask token>
cv2.imshow('Gaussian Thresh', gaussianThresh)
cv2.imshow('Comparison', np.hstack([blurred, meanThresh, gaussianThresh]))
cv2.waitKey(0)

<mask token>
image = cv2.imread('coins.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
cv2.imshow('Blurred Image', blurred)
meanThresh = cv2.adaptiveThreshold(blurred, 255, cv2.ADAPTIVE_THRESH_MEAN_C,
    cv2.THRESH_BINARY_INV, 11, 4)
cv2.imshow('Mean Thresh', meanThresh)
gaussianThresh = cv2.adaptiveThreshold(blurred, 255, cv2.
    ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 15, 3)
cv2.imshow('Gaussian Thresh', gaussianThresh)
cv2.imshow('Comparison', np.hstack([blurred, meanThresh, gaussianThresh]))
cv2.waitKey(0)

import numpy as np
import cv2
image = cv2.imread('coins.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
cv2.imshow('Blurred Image', blurred)
meanThresh = cv2.adaptiveThreshold(blurred, 255, cv2.ADAPTIVE_THRESH_MEAN_C,
    cv2.THRESH_BINARY_INV, 11, 4)
cv2.imshow('Mean Thresh', meanThresh)
gaussianThresh = cv2.adaptiveThreshold(blurred, 255, cv2.
    ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 15, 3)
cv2.imshow('Gaussian Thresh', gaussianThresh)
cv2.imshow('Comparison', np.hstack([blurred, meanThresh, gaussianThresh]))
cv2.waitKey(0)

import numpy as np
import cv2

# Loading image
image = cv2.imread("coins.jpg")
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
cv2.imshow("Blurred Image", blurred)

# Applying adaptive thresholding
meanThresh = cv2.adaptiveThreshold(blurred, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY_INV, 11, 4)
cv2.imshow("Mean Thresh", meanThresh)

gaussianThresh = cv2.adaptiveThreshold(blurred, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 15, 3)
cv2.imshow("Gaussian Thresh", gaussianThresh)

cv2.imshow("Comparison", np.hstack([blurred, meanThresh, gaussianThresh]))

cv2.waitKey(0)