package bimage

  1. Overview
  2. Docs

Op is used to define pixel-level operations. These operations are performed on normalized floating-point values

type ('a, 'b, 'c) t = ('a, 'b, 'c) Image.t array -> int -> int -> int -> float
type ('a, 'b, 'c) f = float -> ('a, 'b, 'c) Image.t array -> int -> int -> int -> float
val blend : ('a, 'b, 'c) t

Blend two images: a + b / 2

val min : ('a, 'b, 'c) t

Minimum pixel value of two images

val max : ('a, 'b, 'c) t

Maximum pixel value of two images

val grayscale : ('a, 'b, [< `Rgb | `Rgba ]) t

Convert a color image to grayscale

val color : ('a, 'b, [ `Gray ]) t

Convert a grayscale image to color

val eval : ?x:int Stdlib.ref -> ?y:int Stdlib.ref -> ?c:int Stdlib.ref -> ('a, 'b, 'c) t -> ('a, 'b, 'c, 'd, 'e, 'f) filter

Evaluate an operation

val join : (float -> float -> float) -> ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> ('a, 'b, 'c) t

join f a b builds a new operation of f(a, b)

val apply : ('a, 'b, 'c) f -> ('a, 'b, 'c) t -> ('a, 'b, 'c) t

map f a builds a new operation of f(a)

val scalar : ('a, 'b, 'c) f

Builds an operation returning a single value

val scalar_max : ('a, 'b) kind -> ('a, 'b, 'c) t

Builds an operation returning the maximum value for a given kind

val scalar_min : ('a, 'b) kind -> ('a, 'b, 'c) t

Builds an operation returning the minimum value for a given kind

val invert_f : ('a, 'b, 'c) f

Invert a single value

val invert : ('a, 'b, 'c) t

Invert the values in an image

val cond : (('a, 'b, 'c) Image.t array -> int -> int -> int -> bool) -> ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> ('a, 'b, 'c) t

Conditional operation

val kernel : Kernel.t -> ('a, 'b, 'c) t

Create a kernel operation

val join_kernel : (float -> float -> float) -> Kernel.t -> Kernel.t -> ('a, 'b, 'c) t

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

val combine_kernels : Kernel.t -> Kernel.t -> ('a, 'b, 'c) t
val (&+) : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> ('a, 'b, 'c) t

Infix operator for join using addition

val (&-) : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> ('a, 'b, 'c) t

Infix operator for join using subtraction

val (&*) : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> ('a, 'b, 'c) t

Infix operator for join using multiplication

val (&/) : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> ('a, 'b, 'c) t

Infix operator for join using division

val (%+) : Kernel.t -> Kernel.t -> ('a, 'b, 'c) t

Infix operator for join_kernel using addition

val (%-) : Kernel.t -> Kernel.t -> ('a, 'b, 'c) t

Infix operator for join_kernel using subtraction

val (%*) : Kernel.t -> Kernel.t -> ('a, 'b, 'c) t

Infix operator for join_kernel using multiplication

val (%/) : Kernel.t -> Kernel.t -> ('a, 'b, 'c) t

Infix operator for join_kernel using division

val ($) : ('a, 'b, 'c) t -> ('a, 'b, 'c) f -> ('a, 'b, 'c) t

Infix operator for map

val sobel_x : ('a, 'b, 'c) t

Sobel in the X direction

val sobel_y : ('a, 'b, 'c) t

Sobel in the Y direction

val sobel : ('a, 'b, 'c) t

Sobel kernel

val gaussian_blur : ?std:float -> int -> ('a, 'b, 'c) t

Blur using gaussian kernel. The size must be an odd number.

val transform : Transform.t -> ('a, 'b, 'c) t

Apply a transformation

val rotate : ?center:(float * float) -> Angle.t -> ('a, 'b, 'c) t

Rotation operation

val scale : float -> float -> ('a, 'b, 'c) t

Scale an image by the given amount

val brightness : float -> ('a, 'b, 'c) t

Adjust the brightness of an image. 0.0 will remove all brightness and 1.0 will keep the image as-is.

val threshold : float array -> ('a, 'b, 'c) t

Per-channel threshold -- each entry in the given array is the threshold for the channel with the same index