Skip to content

Instantly share code, notes, and snippets.

@chiffa
Created February 12, 2018 18:36
Show Gist options
  • Save chiffa/58163205d1cede5efd8d74f7754498a3 to your computer and use it in GitHub Desktop.
Save chiffa/58163205d1cede5efd8d74f7754498a3 to your computer and use it in GitHub Desktop.
Otsu threshold debug GIST #2
from skimage import io
from skimage.filters import rank
from skimage.morphology import disk
from time import time
import numpy as np
import pickle
# base_image = pickle.load(open('debug_dump.dmp', 'r'))
# np.save('debug_image.npy', base_image)
base_image = np.load('debug_image.npy')
selem2 = disk(50)
print 'base image', base_image.shape, base_image.dtype
print 'mask', selem2.shape, selem2.dtype
# io.imshow(base_image)
# io.show()
start = time()
local_otsu = rank.otsu(base_image, selem2)
print 'local otsu time: %0.2f seconds' % (time() - start)
# io.imshow(local_otsu)
# io.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment