Skip to content

Instantly share code, notes, and snippets.

View KedoKudo's full-sized avatar

Chen Zhang KedoKudo

View GitHub Profile
#perform histogram equalization with numpy, without explicitly computing the histogram
#im is a numpy array, of any dimension
im2 = numpy.sort(im.ravel()).searchsorted(im)
@KedoKudo
KedoKudo / kmeans.pyx
Last active August 29, 2015 14:26 — forked from dwf/kmeans.pyx
Parallelized k-means in Cython.
"""
Parallelized k-means module.
By David Warde-Farley, February 2012. Licensed under the 3-clause BSD.
"""
cimport cython
from cython.parallel import prange
import numpy as np
cimport numpy as np
from numpy.random import normal