package bimage

  1. Overview
  2. Docs

Expr define a combinator which can be used to build filters

type pixel = Color.rgb Pixel.t
type image = Image.any
type 'a t =
  1. | Kernel : Input.index * Kernel.t -> pixel t
  2. | Transform : Input.index * Transform.t -> pixel t
  3. | Image : Input.index -> image t
  4. | Input : Input.index * int t * int t -> pixel t
  5. | X : int t
  6. | Y : int t
  7. | Int : int -> int t
  8. | Float : float -> float t
  9. | Bool : bool -> bool t
  10. | Gt : 'a t * 'a t -> bool t
  11. | Eq : 'a t * 'a t -> bool t
  12. | Lt : 'a t * 'a t -> bool t
  13. | And : bool t * bool t -> bool t
  14. | Or : bool t * bool t -> bool t
  15. | Not : bool t -> bool t
  16. | Cond : bool t * 'a t * 'a t -> 'a t
  17. | Func : 'b t * (int -> int -> 'b -> 'a t) -> 'a t
  18. | Pixel : 'b Pixel.t -> pixel t
  19. | Pixel_get : pixel t * int t -> float t
  20. | Pixel_set : pixel t * int t * float t -> pixel t
  21. | Value : 'a -> 'a t
  22. | Pair : 'a t * 'b t -> ('a * 'b) t
  23. | Shape : Input.index -> (int * int * int) t
  24. | Option : 'a t option -> 'a option t
val compute_at : ?x:int ref -> ?y:int ref -> pixel t -> Input.t -> int -> int -> pixel

Compute value of expression at the given point

val int : int -> int t

Create an int Expr

val float : float -> float t

Create a float Expr

val int_of_float : float t -> int t
val float_of_int : int t -> float t
val x : int t
val y : int t
val some : 'a t -> 'a option t
val none : 'a option t
val pixel : 'a Pixel.t -> pixel t
val pixel_map : (float -> float) -> pixel t -> pixel t
val image : ?input:Input.index -> unit -> image t
val get : pixel t -> int t -> float t

Get pixel index

val set : pixel t -> int t -> float t -> pixel t

Set pixel index

val set_rgb : pixel t -> float t -> float t -> float t -> pixel t

Update pixel with RGB values

val input : ?index:Input.index -> int t -> int t -> pixel t

Get input data from the specified index

val value : 'a -> 'a t

Create a Value expr

val shape : ?input:Input.index -> unit -> (int * int * int) t
val func : 'b t -> (int -> int -> 'b -> 'a t) -> 'a t

Create a Func expr

val kernel : ?input:Input.index -> Kernel.t -> pixel t

Create a kernel expr from an existing kernel

val combine_kernel : ?input:Input.index -> (float -> float -> float) -> Kernel.t t -> Kernel.t t -> pixel t

Create a kernel expession using two kernels combined using the designated operation

val kernel_3x3 : ?input:Input.index -> Kernel.t -> pixel t
val gaussian_blur : ?std:float -> ?input:Input.index -> int -> pixel t
val sobel_x : ?input:Input.index -> unit -> pixel t
val sobel_y : ?input:Input.index -> unit -> pixel t
val sobel : ?input:Input.index -> unit -> pixel t
val transform : ?input:Input.index -> Transform.t -> pixel t

Apply a transformation

val rotate : ?input:Input.index -> ?center:(float * float) -> float -> pixel t
val rotate_90 : ?input:Input.index -> unit -> pixel t
val rotate_180 : ?input:Input.index -> unit -> pixel t
val rotate_270 : ?input:Input.index -> unit -> pixel t
val scale : ?input:Input.index -> float -> float -> pixel t
val resize : ?input:Input.index -> int -> int -> pixel t
val pair : 'a t -> 'b t -> ('a * 'b) t

Create a new Pair expr, used for joining existing expressions

val channels : ?input:Input.index -> unit -> int t
val map : ('b -> 'a t) -> 'b t -> 'a t
val let* : 'b t -> ('b -> 'a t) -> 'a t
val let+ : 'b t -> ('b -> 'a) -> 'a t
val map2 : ('a -> 'b -> 'c t) -> 'a t -> 'b t -> 'c t
val fadd : float t -> float t -> float t
val fsub : float t -> float t -> float t
val fmul : float t -> float t -> float t
val fdiv : float t -> float t -> float t
val iadd : int t -> int t -> int t
val isub : int t -> int t -> int t
val imul : int t -> int t -> int t
val idiv : int t -> int t -> int t
val pow : float t -> float t -> float t
val sqrt : float t -> float t
val sin : float t -> float t
val cos : float t -> float t
val tan : float t -> float t
val pi : unit -> float t
val and_ : bool t -> bool t -> bool t
val or_ : bool t -> bool t -> bool t
val not_ : bool t -> bool t
val cond : bool t -> 'a t -> 'a t -> 'a t
val blend : ?input0:Input.index -> ?input1:Input.index -> unit -> pixel t

An expression to average two images

val min : ?input0:Input.index -> ?input1:Input.index -> unit -> pixel t

An expression to take the lowest value from two images

val max : ?input0:Input.index -> ?input1:Input.index -> unit -> pixel t

An expression to take the highest value from two images

val brightness : ?input:Input.index -> float t -> pixel t

Multiply each pixel component

val grayscale : ?input:Input.index -> unit -> pixel t
val color : ?input:Input.index -> unit -> pixel t
val invert : ?input:Input.index -> unit -> pixel t
val gamma : ?input:Input.index -> float -> pixel t
val gamma_log : ?input:Input.index -> ?gamma:float -> unit -> pixel t
val gamma_lin : ?input:Input.index -> ?gamma:float -> unit -> pixel t
module Infix : sig ... end
OCaml

Innovation. Community. Security.