Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
14
Task/Bitmap-Histogram/OCaml/bitmap-histogram-1.ocaml
Normal file
14
Task/Bitmap-Histogram/OCaml/bitmap-histogram-1.ocaml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
type histogram = int array
|
||||
|
||||
let get_histogram ~img:gray_channel =
|
||||
let width = Bigarray.Array2.dim1 gray_channel
|
||||
and height = Bigarray.Array2.dim2 gray_channel in
|
||||
let t = Array.make 256 0 in
|
||||
for x = 0 to pred width do
|
||||
for y = 0 to pred height do
|
||||
let v = gray_get_pixel_unsafe gray_channel x y in
|
||||
t.(v) <- t.(v) + 1;
|
||||
done;
|
||||
done;
|
||||
(t: histogram)
|
||||
;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue