package bimage
Library
Module
Module type
Parameter
Class
Class type
The Image module defines a simple interface for manipulating image data
create kind color width height
makes a new image with the given kind
, color
and dimensions
of_data color width height layout data
makes a new image from existing image data with the given kind
, color
, layout
, and dimensions
like img
creates a new image with the same dimensions, color and kind as img
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 kind
Convert an image to a new image of another kind
Convert from any
color to the given color
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 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 float value
val get_n : ('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_n : ('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.
Apply a kernel directly to the provided image. Note that this implementation is much slower than `Op.kernel`, it is mostly provided for convenience
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
val fold : ('a -> 'd -> 'd) -> ('a, 'b, 'c) t -> 'd -> 'd
val map_inplace : ('a -> 'a) -> ('a, 'b, 'c) t -> unit
module Diff : sig ... end