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 -> ('a, 'b, 'c) Image.t array -> int -> int -> int -> float
Sourceval blend : ('a, 'b, 'c) t

Blend two images: a + b / 2

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

Minimum pixel value of two images

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

Maximum pixel value of two images

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

Convert a color image to grayscale

Sourceval color : ('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 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 : ('a, 'b, 'c) f

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

Invert a single value

Sourceval invert : ('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 kernel : Kernel.t -> ('a, 'b, 'c) t

Create a kernel operation

Sourceval 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

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

Infix operator for join using addition

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

Infix operator for join using subtraction

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

Infix operator for join using multiplication

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

Infix operator for join using division

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

Infix operator for join_kernel using addition

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

Infix operator for join_kernel using subtraction

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

Infix operator for join_kernel using multiplication

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

Infix operator for join_kernel using division

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

Infix operator for map

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

Sobel in the X direction

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

Sobel in the Y direction

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

Sobel kernel

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

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

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

Apply a transformation

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

Rotation operation

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

Scale an image by the given amount

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

Sourceval 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

OCaml

Innovation. Community. Security.