Skip to content

Instantly share code, notes, and snippets.

@ankush-me
ankush-me / char_colors.py
Created May 10, 2017 23:02
Using K-means for learning color models for text/background.
def quantize(viz=False):
dpath = '../data/IIIT5K'
colors = np.zeros((5000,4*3)) # (c1,c1_std,c2,c2_std) (foreground,background)
i = 0
for dset in ['test','train']:
annfile = dset+'CharBound'
dat = sio.loadmat(dpath+'/'+annfile+'.mat')[annfile][0]
N = dat.size
for j in xrange(N):
print i