Avoid unnecessary conversions in Image.bitmap to make it faster.
This commit is contained in:
parent
00508d1919
commit
e55b66ddd6
1 changed files with 1 additions and 4 deletions
|
|
@ -19,7 +19,6 @@ from io import BytesIO
|
|||
|
||||
import numpy as np
|
||||
from skimage.io import imread, imsave
|
||||
from skimage.color import rgb2gray
|
||||
|
||||
from .utils import cached_property, pairwise
|
||||
|
||||
|
|
@ -156,9 +155,7 @@ class Image(object):
|
|||
0 = white (blank) pixel
|
||||
1 = black (glyph) pixel
|
||||
"""
|
||||
|
||||
grayscale = rgb2gray(self.data)
|
||||
return (grayscale < 1).astype('b')
|
||||
return (self.data != 255).any(axis=2)
|
||||
|
||||
@cached_property
|
||||
def isspace(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue