Skimage umbral local

import cv2
from skimage.filters import threshold_local

image = cv2.imread("path/to/image")

# block size must be odd
thresh = threshold_local(image, block_size = 3, offset = 0.02)
binary_image = image > thresh
wolf-like_hunter