Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
14
Task/Bitmap-Histogram/OCaml/bitmap-histogram-1.ml
Normal file
14
Task/Bitmap-Histogram/OCaml/bitmap-histogram-1.ml
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