package bimage
Library
Module
Module type
Parameter
Class
Class type
Image
defines an image type and functions that manipulate images directly
v ty color width height
makes a new image with the given ty
, color
and dimensions
of_data color width height data
makes a new image from existing image data with the given ty
, color
, and dimensions
like img
creates a new image with the same dimensions, color and ty as img
Create an image with the same dimensions and type
Create an image with the name dimensions and color
val channels : ('a, 'b, 'c) t -> int
Returns the number of channels in an image
val length : ('a, 'b, 'c) t -> int
Returns the number of values contained in an image
val shape : ('a, 'b, 'c) t -> int * int * int
Returns the width, height and channels
Convert an image to an existing image of another ty
Convert an image to a new image of another ty
val get : ('a, 'b, 'c) t -> int -> int -> int -> 'a
get image x y c
returns a the value at (x, y, c)
val set : ('a, 'b, 'c) t -> int -> int -> int -> 'a -> unit
Set a single channel of the given image at (x, y)
val get_f : ('a, 'b, 'c) t -> int -> int -> int -> float
get_f image x y c
returns the normalized float value at (x, y, c)
val set_f : ('a, 'b, 'c) t -> int -> int -> int -> float -> unit
Set a single channel of the given image at (x, y) using a normalized float value
get_pixel image x y
returns a pixel representation of image
data at (x
, y
)
set_pixel image x y px
sets the value of image
at (x
, y
) to px
get_data image x y
returns image
data at (x
, y
)
set_data image x y px
sets the value of image
at (x
, y
) to px
val for_each :
(int -> int -> ('a, 'b) Data.t -> unit) ->
?x:int ->
?y:int ->
?width:int ->
?height:int ->
('a, 'b, 'c) t ->
unit
Iterate over each pixel in an image, or a rectangle segment of an image specified by x
, y
, width
, and height
. The data segment used in the callback is mutable and will write directly to the underlying image data.
val for_each_pixel :
(int -> int -> 'c Pixel.t -> unit) ->
?x:int ->
?y:int ->
?width:int ->
?height:int ->
('a, 'b, 'c) t ->
unit
Iterate over each pixel in an image
val avg :
?x:int ->
?y:int ->
?width:int ->
?height:int ->
('a, 'b, 'c) t ->
(float, Type.f64) Data.t
Get the average pixel of an image or region of an image
Extract the sub-image specified by the given dimensions
val mean_std : ?channel:int -> ('a, 'b, 'c) t -> float * float
Calculate the mean and standard deviation of an image
module Diff : sig ... end