Skip to content

Instantly share code, notes, and snippets.

@steveway
Created April 18, 2017 15:51
Show Gist options
  • Select an option

  • Save steveway/4c91087881b263fe3ecfab7901856dfd to your computer and use it in GitHub Desktop.

Select an option

Save steveway/4c91087881b263fe3ecfab7901856dfd to your computer and use it in GitHub Desktop.
Belongs to the opencvvideoclock.py, test using cython for this.
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