mirror of https://github.com/AlfredoSequeida/fvid
Major optimization by removing calls to tuple()
This brought the time taken by get_bits_from_image from 6.35 seconds to 4.9 seconds on my processor!
This commit is contained in:
parent
83084dc456
commit
b9eee98a25
|
@ -66,9 +66,9 @@ def get_bits_from_image(image):
|
||||||
elif pixel == black:
|
elif pixel == black:
|
||||||
pixel_bin_rep = "0"
|
pixel_bin_rep = "0"
|
||||||
else:
|
else:
|
||||||
white_diff = tuple(np.absolute(np.subtract(white, pixel)))
|
white_diff = np.absolute(np.subtract(white, pixel))
|
||||||
# min_diff = white_diff
|
# min_diff = white_diff
|
||||||
black_diff = tuple(np.absolute(np.subtract(black, pixel)))
|
black_diff = np.absolute(np.subtract(black, pixel))
|
||||||
|
|
||||||
# if the white difference is smaller, that means the pixel is closer
|
# if the white difference is smaller, that means the pixel is closer
|
||||||
# to white, otherwise, the pixel must be black
|
# to white, otherwise, the pixel must be black
|
||||||
|
|
Loading…
Reference in New Issue