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 Expr.t -> ('a, 'b, 'c) t
val blend : ?input:Input.index -> ?input1:Input.index -> ('a, 'b, 'c) t

Blend two images: a + b / 2

val min : ?input:Input.index -> ?input1:Input.index -> ('a, 'b, 'c) t

Minimum pixel value of two images

val max : ?input:Input.index -> ?input1:Input.index -> ('a, 'b, 'c) t

Maximum pixel value of two images

val grayscale : ?input:Input.index -> ('a, 'b, [< `Rgb | `Rgba ]) t

Convert a color image to grayscale

val color : ?input:Input.index -> ('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 eval_expr : ?x:int Stdlib.ref -> ?y:int Stdlib.ref -> ?c:int Stdlib.ref -> float Expr.t -> ('a, 'b, 'c, 'd, 'e, 'f) filter

Convert an Expr to a filter

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 : float -> ('a, 'b, 'c) t

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 : ?input:Input.index -> ('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 sobel_x : ?input:Input.index -> ('a, 'b, 'c) t

Sobel in the X direction

val sobel_y : ?input:Input.index -> ('a, 'b, 'c) t

Sobel in the Y direction

val sobel : ?input:Input.index -> ('a, 'b, 'c) t

Sobel kernel

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

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

val transform : ?input:Input.index -> Transform.t -> ('a, 'b, 'c) t

Apply a transformation

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

Rotation operation

val scale : ?input:Input.index -> float -> float -> ('a, 'b, 'c) t

Scale an image by the given amount

val brightness : ?input:Input.index -> float Expr.t -> ('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 : ?input:Input.index -> 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

module Infix : sig ... end