View Source Image.Math (image v0.33.0)

Implements math operators for images, delegating to the Kernel functions in the cases where the parameters do not include Vix.Vips.Image.t/0.

To override the standard operations in a function or module, add use Image.Math.

To maximise readability and clarity it is recommended that use Image.Math be added to only those functions that require it.

example

Example

defmodule MyModule do
  # Not recommended
  use Image.Math

  def my_function(%Vix.Vips.Image{} = image) do
    # Recommended
    use Image.Math

    # Increase the all bands by 20%
    brigher = image * 1.2

    # Or adjust only green by 20%
    bright_green = image * [1, 1.2, 1]
  end
end

Link to this section Summary

Functions

Matrix bitwise 'and' of two images.

Matrix exponent of two images or one image and a constant or vector.

Matrix multiplation of two images or one image and a constant or vector.

Matrix addition of two images or one image and a constant or vector.

Matrix subtraction of two images or one image and a constant or vector.

Matrix division of two images or one image and a constant or vector.

Matrix inequality of two images or one image and a constant or vector.

Matrix less than of two images or one image and a constant or vector.

Matrix bitwise 'left shift' of two images.

Matrix less than or equal of two images or one image and a constant or vector.

Matrix equality of two images or one image and a constant or vector.

Matrix greater than of two images or one image and a constant or vector.

Matrix greater than or equal of two images or one image and a constant or vector.

Matrix bitwise 'right shift' of two images.

Guards if a given value might be reasonably interpreted as a pixel.

Return the image maximum.

Return the image minimum.

Matrix bitwise 'or' of two images.

Link to this section Functions

Matrix bitwise 'and' of two images.

Matrix exponent of two images or one image and a constant or vector.

Delegates to Kernel.**/2 if none of the parameters is a Vix.Vips.Image.t/0.

Matrix multiplation of two images or one image and a constant or vector.

Delegates to Kernel.*/2 if none of the parameters is a Vix.Vips.Image.t/0.

Matrix addition of two images or one image and a constant or vector.

Delegates to Kernel.+/2 if none of the parameters is a Vix.Vips.Image.t/0.

Matrix subtraction of two images or one image and a constant or vector.

Delegates to Kernel.-/2 if none of the parameters is a Vix.Vips.Image.t/0.

Matrix division of two images or one image and a constant or vector.

Delegates to Kernel.//2 if none of the parameters is a Vix.Vips.Image.t/0.

Matrix inequality of two images or one image and a constant or vector.

Delegates to Kernel.!=/2 if none of the parameters is a Vix.Vips.Image.t/0.

Matrix less than of two images or one image and a constant or vector.

Delegates to Kernel.</2 if none of the parameters is a Vix.Vips.Image.t/0.

Matrix bitwise 'left shift' of two images.

Matrix less than or equal of two images or one image and a constant or vector.

Delegates to Kernel.<=/2 if none of the parameters is a Vix.Vips.Image.t/0.

Matrix equality of two images or one image and a constant or vector.

Delegates to Kernel.==/2 if none of the parameters is a Vix.Vips.Image.t/0.

Matrix greater than of two images or one image and a constant or vector.

Delegates to Kernel.>/2 if none of the parameters is a Vix.Vips.Image.t/0.

Matrix greater than or equal of two images or one image and a constant or vector.

Delegates to Kernel.>=/2 if none of the parameters is a Vix.Vips.Image.t/0.

Matrix bitwise 'right shift' of two images.

@spec add(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec add(Vix.Vips.Image.t(), number()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec add(Vix.Vips.Image.t(), [number()]) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec add(number(), number()) :: {:ok, number()}
@spec add!(Vix.Vips.Image.t(), Image.pixel() | number()) ::
  Vix.Vips.Image.t() | no_return()
@spec add!(Image.pixel() | number(), Vix.Vips.Image.t()) ::
  Vix.Vips.Image.t() | no_return()
@spec add!(number(), number()) :: number() | no_return()
Link to this function

boolean_and(image_1, image_2)

View Source
@spec boolean_and(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
Link to this function

boolean_and!(image_1, image_2)

View Source
@spec boolean_and!(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  Vix.Vips.Image.t() | no_return()
Link to this function

boolean_lshift(image_1, image_2)

View Source
@spec boolean_lshift(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
Link to this function

boolean_lshift!(image_1, image_2)

View Source
@spec boolean_lshift!(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  Vix.Vips.Image.t() | no_return()
Link to this function

boolean_or(image_1, image_2)

View Source
@spec boolean_or(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
Link to this function

boolean_or!(image_1, image_2)

View Source
@spec boolean_or!(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  Vix.Vips.Image.t() | no_return()
Link to this function

boolean_rshift(image_1, image_2)

View Source
@spec boolean_rshift(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
Link to this function

boolean_rshift!(image_1, image_2)

View Source
@spec boolean_rshift!(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  Vix.Vips.Image.t() | no_return()
Link to this function

boolean_xor(image_1, image_2)

View Source
@spec boolean_xor(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
Link to this function

boolean_xor!(image_1, image_2)

View Source
@spec boolean_xor!(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  Vix.Vips.Image.t() | no_return()
@spec cos(Vix.Vips.Image.t()) :: {:ok, Vix.Vips.Image.t()}
@spec cos(number()) :: {:ok, number()}
@spec divide(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec divide(Vix.Vips.Image.t(), number()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec divide(Vix.Vips.Image.t(), [number()]) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec divide(number(), number()) :: {:ok, number()}
@spec divide!(Vix.Vips.Image.t(), Image.pixel()) :: Vix.Vips.Image.t() | no_return()
@spec divide!(number(), number()) :: number() | no_return()
@spec equal(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec equal(Vix.Vips.Image.t(), Image.pixel()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec equal!(Vix.Vips.Image.t(), Image.pixel()) :: Vix.Vips.Image.t() | no_return()
@spec equal!(number(), number()) :: number() | no_return()
Link to this function

greater_than(image, other)

View Source
@spec greater_than(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec greater_than(Vix.Vips.Image.t(), Image.pixel()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
Link to this function

greater_than!(image, value)

View Source
@spec greater_than!(Vix.Vips.Image.t(), Vix.Vips.Image.t() | Image.pixel()) ::
  Vix.Vips.Image.t() | no_return()
@spec greater_than!(number(), number()) :: number() | no_return()
Link to this function

greater_than_or_equal(image, other)

View Source
@spec greater_than_or_equal(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec greater_than_or_equal(Vix.Vips.Image.t(), Image.pixel()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
Link to this function

greater_than_or_equal!(image, value)

View Source
@spec greater_than_or_equal!(Vix.Vips.Image.t(), Image.pixel()) ::
  Vix.Vips.Image.t() | no_return()
@spec greater_than_or_equal!(number(), number()) :: number() | no_return()
Link to this macro

is_pixel(value)

View Source (macro)

Guards if a given value might be reasonably interpreted as a pixel.

@spec less_than(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec less_than(Vix.Vips.Image.t(), Image.pixel()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
Link to this function

less_than!(image, value)

View Source
@spec less_than!(Vix.Vips.Image.t(), Vix.Vips.Image.t() | Image.pixel()) ::
  Vix.Vips.Image.t() | no_return()
@spec less_than!(number(), number()) :: number() | no_return()
Link to this function

less_than_or_equal(image, other)

View Source
@spec less_than_or_equal(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec less_than_or_equal(Vix.Vips.Image.t(), Image.pixel()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
Link to this function

less_than_or_equal!(image, value)

View Source
@spec less_than_or_equal!(Vix.Vips.Image.t(), Vix.Vips.Image.t() | Image.pixel()) ::
  Vix.Vips.Image.t() | no_return()
@spec less_than_or_equal!(number(), number()) :: number() | no_return()
Link to this function

maxpos(image, options \\ [])

View Source
@spec maxpos(Vix.Vips.Image.t(), Keyword.t()) ::
  {maximum :: float(), x_positiom :: integer(), y_position :: integer()}

Return the image maximum.

arguments

Arguments

options

Options

  • :size is the number of maximums to find. The default is 10.

returns

Returns

  • {:ok, maximum, x_position, y_position}
Link to this function

minpos(image, options \\ [])

View Source
@spec minpos(Vix.Vips.Image.t(), Keyword.t()) ::
  {minimum :: float(), x_positiom :: integer(), y_position :: integer()}

Return the image minimum.

arguments

Arguments

options

Options

  • :size is the number of minimums to find. The default is 10.

returns

Returns

  • {:ok, minimum, x_position, y_position}
@spec multiply(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec multiply(Vix.Vips.Image.t(), number()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec multiply(Vix.Vips.Image.t(), list()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec multiply(number(), number()) :: {:ok, number()}
@spec multiply!(Vix.Vips.Image.t(), Image.pixel() | number()) ::
  Vix.Vips.Image.t() | no_return()
@spec multiply!(Image.pixel() | number(), Vix.Vips.Image.t()) ::
  Vix.Vips.Image.t() | no_return()
@spec multiply!(number(), number()) :: number() | no_return()
@spec not_equal(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec not_equal(Vix.Vips.Image.t(), Image.pixel()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
Link to this function

not_equal!(image, value)

View Source
@spec not_equal!(Vix.Vips.Image.t(), Image.pixel()) ::
  Vix.Vips.Image.t() | no_return()
@spec not_equal!(number(), number()) :: number() | no_return()
@spec pow(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec pow(Vix.Vips.Image.t(), number()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec pow(number(), number()) :: {:ok, number()}
@spec pow!(Vix.Vips.Image.t(), number()) :: Vix.Vips.Image.t() | no_return()
@spec pow!(number(), number()) :: number() | no_return()
@spec sin(Vix.Vips.Image.t()) :: {:ok, Vix.Vips.Image.t()}
@spec sin(number()) :: {:ok, number()}
@spec subtract(Vix.Vips.Image.t(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec subtract(Vix.Vips.Image.t(), number()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec subtract(Vix.Vips.Image.t(), [number()]) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec subtract(number(), Vix.Vips.Image.t()) ::
  {:ok, Vix.Vips.Image.t()} | {:error, Image.error_message()}
@spec subtract(number(), number()) :: {:ok, number()}
@spec subtract!(Vix.Vips.Image.t(), Image.pixel()) :: Vix.Vips.Image.t() | no_return()
@spec subtract!(Image.pixel(), Vix.Vips.Image.t()) :: Vix.Vips.Image.t() | no_return()
@spec subtract!(number(), number()) :: number() | no_return()

Matrix bitwise 'or' of two images.