diff --git a/pixelocr/image.py b/pixelocr/image.py index 57a9762..b380fe6 100644 --- a/pixelocr/image.py +++ b/pixelocr/image.py @@ -18,7 +18,6 @@ import itertools from io import BytesIO import numpy as np -from scipy.stats.mstats import mode from skimage.io import imread, imsave from .utils import cached_property, pairwise @@ -170,8 +169,8 @@ class Image(object): return None mask3 = np.dstack([~self.bitmap] * 3) colors = np.ma.MaskedArray(self.data, mask3).reshape(-1, 3) - modes, counts = mode(colors) - return tuple(modes[0]) + r, g, b = colors.mean(axis=0) + return int(r), int(g), int(b) def serialize(self): """Serialize the image as some hashable object."""