Created
April 18, 2017 15:51
-
-
Save steveway/4c91087881b263fe3ecfab7901856dfd to your computer and use it in GitHub Desktop.
Belongs to the opencvvideoclock.py, test using cython for this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| def apply_ordered_dither(inputarray, bayer_map, bayer_size): | |
| width, height = inputarray.shape | |
| for y in range(height): | |
| for x in range(width): | |
| inputarray[x, y] = 0 if inputarray[x, y] < bayer_map[x % bayer_size, y % bayer_size] else 255 | |
| return inputarray |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment