/example2.ml Secret
Last active
August 29, 2015 14:04
This file contains 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
let random_dithering matrix (width, height) style = | |
(*We convert the image in grey level according to style*) | |
let new_matrix = grey matrix (width, height) style in | |
for j = 0 to height - 1 do | |
for i = 0 to width - 1 do | |
let threshold = Random.int 256 in | |
if get_r new_matrix.(i).(j) < threshold then | |
new_matrix.(i).(j) <- (0, 0 ,0) (*Black*) | |
else | |
new_matrix.(i).(j) <- (255, 255, 255); (*White*) | |
done; | |
done; | |
new_matrix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment