package bimage

  1. Overview
  2. Docs

Module Bimage.OpSource

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

Sourcetype ('a, 'b, 'c) t = ('a, 'b, 'c) Image.t array -> int -> int -> int -> float
Sourcetype ('a, 'b, 'c) f = float Expr.t -> ('a, 'b, 'c) t
Sourceval blend : ?input:Input.index -> ?input1:Input.index -> ('a, 'b, 'c) t

Blend two images: a + b / 2

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

Minimum pixel value of two images

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

Maximum pixel value of two images

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

Convert a color image to grayscale

Sourceval color : ?input:Input.index -> ('a, 'b, [ `Gray ]) t

Convert a grayscale image to color

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

Evaluate an operation

Sourceval eval_expr : ?x:int ref -> ?y:int ref -> ?c:int ref -> float Expr.t -> ('a, 'b, 'c, 'd, 'e, 'f) filter

Convert an Expr to a filter

Sourceval 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)

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

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

Sourceval scalar : float -> ('a, 'b, 'c) t

Builds an operation returning a single value

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

Builds an operation returning the maximum value for a given kind

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

Builds an operation returning the minimum value for a given kind

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

Invert the values in an image

Sourceval 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

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

Sobel in the X direction

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

Sobel in the Y direction

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

Sobel kernel

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

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

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

Apply a transformation

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

Rotation operation

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

Scale an image by the given amount

Sourceval 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.

Sourceval 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

Sourcemodule Infix : sig ... end