package bimage

  1. Overview
  2. Docs

Pixels are float vectors used to store normalized image data

type t
val empty : int -> t

Create a new pixel with all channels set to 0

val length : t -> int

Get the number of channels in a pixel

val compare : t -> t -> int
val equal : t -> t -> bool
val from_data : ('a, 'b) Data.t -> t

Create a new pixel from existing image data

val to_data : dest:('a, 'b) Data.t -> t -> unit

Copy pixel data to existing image data

val data : t -> (float, f32) Data.t

Returns the underlying pixel data

val rgb_to_xyz : t -> t

Convert pixel from RGB to XYZ

val rgb_to_yuv : t -> t

Convert pixel from RGB to YUV

val map : (float -> float) -> t -> t

map f x executes f for each value in x, returning a new Pixel.t

val map_inplace : (float -> float) -> t -> unit

map_inplace f x executes f for each value in x, assigning the new value to the same * index

val map2 : (float -> float -> float) -> t -> t -> t

map f x executes f for each value in x, returning a new Pixel.t

val map2_inplace : (float -> float -> float) -> t -> t -> unit

map_inplace f x executes f for each value in x, assigning the new value to the same * index

val fold : (float -> 'a -> 'a) -> t -> 'a -> 'a

Reduction over a pixel

val fold2 : (float -> float -> 'a -> 'a) -> t -> t -> 'a -> 'a

Reduction over two pixels

val pp : Format.formatter -> t -> unit
OCaml

Innovation. Community. Security.