View Source Evision.CUDA (Evision v0.1.26-rc1)

Link to this section Summary

Types

t()

Type that represents an CUDA struct.

Functions

Creates a continuous matrix.

Creates a continuous matrix.

Ensures that the size of a matrix is big enough and the matrix has a proper type.

Ensures that the size of a matrix is big enough and the matrix has a proper type.

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising with several computational optimizations. Noise expected to be a gaussian white noise

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising with several computational optimizations. Noise expected to be a gaussian white noise

Modification of fastNlMeansDenoising function for colored images

Modification of fastNlMeansDenoising function for colored images

Returns the number of installed CUDA-enabled devices.

Returns the current device index set by cuda::setDevice or initialized by default.

Performs pure non local means denoising without any simplification, and thus it is not fast.

Performs pure non local means denoising without any simplification, and thus it is not fast.

printCudaDeviceInfo

printShortCudaDeviceInfo

Page-locks the memory of matrix and maps it for the device(s).

Explicitly destroys and cleans up all resources associated with the current device in the current process.

setBufferPoolUsage

Sets a device and initializes it for the current thread.

Unmaps the memory of matrix and makes it pageable again.

Link to this section Types

@type t() :: %Evision.CUDA{ref: reference()}

Type that represents an CUDA struct.

  • ref. reference()

    The underlying erlang resource variable.

Link to this section Functions

Link to this function

createContinuous(rows, cols, type)

View Source
@spec createContinuous(integer(), integer(), integer()) ::
  Evision.Mat.t() | {:error, String.t()}

Creates a continuous matrix.

Positional Arguments
  • rows: int.

    Row count.

  • cols: int.

    Column count.

  • type: int.

    Type of the matrix.

Return
  • arr: Evision.Mat.

    Destination matrix. This parameter changes only if it has a proper type and area ( \f$\texttt{rows} \times \texttt{cols}\f$ ).

Matrix is called continuous if its elements are stored continuously, that is, without gaps at the end of each row.

Python prototype (for reference only):

createContinuous(rows, cols, type[, arr]) -> arr
Link to this function

createContinuous(rows, cols, type, opts)

View Source
@spec createContinuous(integer(), integer(), integer(), [{atom(), term()}, ...] | nil) ::
  Evision.Mat.t() | {:error, String.t()}

Creates a continuous matrix.

Positional Arguments
  • rows: int.

    Row count.

  • cols: int.

    Column count.

  • type: int.

    Type of the matrix.

Return
  • arr: Evision.Mat.

    Destination matrix. This parameter changes only if it has a proper type and area ( \f$\texttt{rows} \times \texttt{cols}\f$ ).

Matrix is called continuous if its elements are stored continuously, that is, without gaps at the end of each row.

Python prototype (for reference only):

createContinuous(rows, cols, type[, arr]) -> arr
Link to this function

ensureSizeIsEnough(rows, cols, type)

View Source
@spec ensureSizeIsEnough(integer(), integer(), integer()) ::
  Evision.Mat.t() | {:error, String.t()}

Ensures that the size of a matrix is big enough and the matrix has a proper type.

Positional Arguments
  • rows: int.

    Minimum desired number of rows.

  • cols: int.

    Minimum desired number of columns.

  • type: int.

    Desired matrix type.

Return

The function does not reallocate memory if the matrix has proper attributes already.

Python prototype (for reference only):

ensureSizeIsEnough(rows, cols, type[, arr]) -> arr
Link to this function

ensureSizeIsEnough(rows, cols, type, opts)

View Source
@spec ensureSizeIsEnough(
  integer(),
  integer(),
  integer(),
  [{atom(), term()}, ...] | nil
) ::
  Evision.Mat.t() | {:error, String.t()}

Ensures that the size of a matrix is big enough and the matrix has a proper type.

Positional Arguments
  • rows: int.

    Minimum desired number of rows.

  • cols: int.

    Minimum desired number of columns.

  • type: int.

    Desired matrix type.

Return

The function does not reallocate memory if the matrix has proper attributes already.

Python prototype (for reference only):

ensureSizeIsEnough(rows, cols, type[, arr]) -> arr
Link to this function

fastNlMeansDenoising(src, h)

View Source
@spec fastNlMeansDenoising(Evision.CUDA.GpuMat.t(), number()) ::
  Evision.CUDA.GpuMat.t() | {:error, String.t()}

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising with several computational optimizations. Noise expected to be a gaussian white noise

Positional Arguments
  • src: Evision.CUDA.GpuMat.

    Input 8-bit 1-channel, 2-channel or 3-channel image.

  • h: float.

    Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise

Keyword Arguments
  • search_window: int.

    Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater search_window - greater denoising time. Recommended value 21 pixels

  • block_size: int.

    Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels

  • stream: Evision.CUDA.Stream.

    Stream for the asynchronous invocations.

Return

This function expected to be applied to grayscale images. For colored images look at FastNonLocalMeansDenoising::labMethod. @sa fastNlMeansDenoising

Python prototype (for reference only):

fastNlMeansDenoising(src, h[, dst[, search_window[, block_size[, stream]]]]) -> dst
Link to this function

fastNlMeansDenoising(src, h, opts)

View Source
@spec fastNlMeansDenoising(
  Evision.CUDA.GpuMat.t(),
  number(),
  [{atom(), term()}, ...] | nil
) ::
  Evision.CUDA.GpuMat.t() | {:error, String.t()}

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising with several computational optimizations. Noise expected to be a gaussian white noise

Positional Arguments
  • src: Evision.CUDA.GpuMat.

    Input 8-bit 1-channel, 2-channel or 3-channel image.

  • h: float.

    Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise

Keyword Arguments
  • search_window: int.

    Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater search_window - greater denoising time. Recommended value 21 pixels

  • block_size: int.

    Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels

  • stream: Evision.CUDA.Stream.

    Stream for the asynchronous invocations.

Return

This function expected to be applied to grayscale images. For colored images look at FastNonLocalMeansDenoising::labMethod. @sa fastNlMeansDenoising

Python prototype (for reference only):

fastNlMeansDenoising(src, h[, dst[, search_window[, block_size[, stream]]]]) -> dst
Link to this function

fastNlMeansDenoisingColored(src, h_luminance, photo_render)

View Source
@spec fastNlMeansDenoisingColored(Evision.CUDA.GpuMat.t(), number(), number()) ::
  Evision.CUDA.GpuMat.t() | {:error, String.t()}

Modification of fastNlMeansDenoising function for colored images

Positional Arguments
  • src: Evision.CUDA.GpuMat.

    Input 8-bit 3-channel image.

  • h_luminance: float.

    Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise

  • photo_render: float.

    float The same as h but for color components. For most images value equals 10 will be enough to remove colored noise and do not distort colors

Keyword Arguments
  • search_window: int.

    Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater search_window - greater denoising time. Recommended value 21 pixels

  • block_size: int.

    Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels

  • stream: Evision.CUDA.Stream.

    Stream for the asynchronous invocations.

Return

The function converts image to CIELAB colorspace and then separately denoise L and AB components with given h parameters using FastNonLocalMeansDenoising::simpleMethod function. @sa fastNlMeansDenoisingColored

Python prototype (for reference only):

fastNlMeansDenoisingColored(src, h_luminance, photo_render[, dst[, search_window[, block_size[, stream]]]]) -> dst
Link to this function

fastNlMeansDenoisingColored(src, h_luminance, photo_render, opts)

View Source
@spec fastNlMeansDenoisingColored(
  Evision.CUDA.GpuMat.t(),
  number(),
  number(),
  [{atom(), term()}, ...] | nil
) :: Evision.CUDA.GpuMat.t() | {:error, String.t()}

Modification of fastNlMeansDenoising function for colored images

Positional Arguments
  • src: Evision.CUDA.GpuMat.

    Input 8-bit 3-channel image.

  • h_luminance: float.

    Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise

  • photo_render: float.

    float The same as h but for color components. For most images value equals 10 will be enough to remove colored noise and do not distort colors

Keyword Arguments
  • search_window: int.

    Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater search_window - greater denoising time. Recommended value 21 pixels

  • block_size: int.

    Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels

  • stream: Evision.CUDA.Stream.

    Stream for the asynchronous invocations.

Return

The function converts image to CIELAB colorspace and then separately denoise L and AB components with given h parameters using FastNonLocalMeansDenoising::simpleMethod function. @sa fastNlMeansDenoisingColored

Python prototype (for reference only):

fastNlMeansDenoisingColored(src, h_luminance, photo_render[, dst[, search_window[, block_size[, stream]]]]) -> dst
Link to this function

getCudaEnabledDeviceCount()

View Source
@spec getCudaEnabledDeviceCount() :: integer() | {:error, String.t()}

Returns the number of installed CUDA-enabled devices.

Return
  • retval: int

Use this function before any other CUDA functions calls. If OpenCV is compiled without CUDA support, this function returns 0. If the CUDA driver is not installed, or is incompatible, this function returns -1.

Python prototype (for reference only):

getCudaEnabledDeviceCount() -> retval
@spec getDevice() :: integer() | {:error, String.t()}

Returns the current device index set by cuda::setDevice or initialized by default.

Return
  • retval: int

Python prototype (for reference only):

getDevice() -> retval
@spec nonLocalMeans(Evision.CUDA.GpuMat.t(), number()) ::
  Evision.CUDA.GpuMat.t() | {:error, String.t()}

Performs pure non local means denoising without any simplification, and thus it is not fast.

Positional Arguments
  • src: Evision.CUDA.GpuMat.

    Source image. Supports only CV_8UC1, CV_8UC2 and CV_8UC3.

  • h: float.

    Filter sigma regulating filter strength for color.

Keyword Arguments
  • search_window: int.

    Size of search window.

  • block_size: int.

    Size of block used for computing weights.

  • borderMode: int.

    Border type. See borderInterpolate for details. BORDER_REFLECT101 , BORDER_REPLICATE , BORDER_CONSTANT , BORDER_REFLECT and BORDER_WRAP are supported for now.

  • stream: Evision.CUDA.Stream.

    Stream for the asynchronous version.

Return

@sa fastNlMeansDenoising

Python prototype (for reference only):

nonLocalMeans(src, h[, dst[, search_window[, block_size[, borderMode[, stream]]]]]) -> dst
Link to this function

nonLocalMeans(src, h, opts)

View Source
@spec nonLocalMeans(Evision.CUDA.GpuMat.t(), number(), [{atom(), term()}, ...] | nil) ::
  Evision.CUDA.GpuMat.t() | {:error, String.t()}

Performs pure non local means denoising without any simplification, and thus it is not fast.

Positional Arguments
  • src: Evision.CUDA.GpuMat.

    Source image. Supports only CV_8UC1, CV_8UC2 and CV_8UC3.

  • h: float.

    Filter sigma regulating filter strength for color.

Keyword Arguments
  • search_window: int.

    Size of search window.

  • block_size: int.

    Size of block used for computing weights.

  • borderMode: int.

    Border type. See borderInterpolate for details. BORDER_REFLECT101 , BORDER_REPLICATE , BORDER_CONSTANT , BORDER_REFLECT and BORDER_WRAP are supported for now.

  • stream: Evision.CUDA.Stream.

    Stream for the asynchronous version.

Return

@sa fastNlMeansDenoising

Python prototype (for reference only):

nonLocalMeans(src, h[, dst[, search_window[, block_size[, borderMode[, stream]]]]]) -> dst
Link to this function

printCudaDeviceInfo(device)

View Source
@spec printCudaDeviceInfo(integer()) :: :ok | {:error, String.t()}

printCudaDeviceInfo

Positional Arguments
  • device: int

Python prototype (for reference only):

printCudaDeviceInfo(device) -> None
Link to this function

printShortCudaDeviceInfo(device)

View Source
@spec printShortCudaDeviceInfo(integer()) :: :ok | {:error, String.t()}

printShortCudaDeviceInfo

Positional Arguments
  • device: int

Python prototype (for reference only):

printShortCudaDeviceInfo(device) -> None
@spec registerPageLocked(Evision.Mat.maybe_mat_in()) :: :ok | {:error, String.t()}

Page-locks the memory of matrix and maps it for the device(s).

Positional Arguments

Python prototype (for reference only):

registerPageLocked(m) -> None
@spec resetDevice() :: :ok | {:error, String.t()}

Explicitly destroys and cleans up all resources associated with the current device in the current process.

Any subsequent API call to this device will reinitialize the device.

Python prototype (for reference only):

resetDevice() -> None
Link to this function

setBufferPoolConfig(deviceId, stackSize, stackCount)

View Source
@spec setBufferPoolConfig(integer(), integer(), integer()) ::
  :ok | {:error, String.t()}

setBufferPoolConfig

Positional Arguments
  • deviceId: int
  • stackSize: size_t
  • stackCount: int

Python prototype (for reference only):

setBufferPoolConfig(deviceId, stackSize, stackCount) -> None
@spec setBufferPoolUsage(boolean()) :: :ok | {:error, String.t()}

setBufferPoolUsage

Positional Arguments
  • on: bool

Python prototype (for reference only):

setBufferPoolUsage(on) -> None
@spec setDevice(integer()) :: :ok | {:error, String.t()}

Sets a device and initializes it for the current thread.

Positional Arguments
  • device: int.

    System index of a CUDA device starting with 0.

If the call of this function is omitted, a default device is initialized at the fist CUDA usage.

Python prototype (for reference only):

setDevice(device) -> None
@spec unregisterPageLocked(Evision.Mat.maybe_mat_in()) :: :ok | {:error, String.t()}

Unmaps the memory of matrix and makes it pageable again.

Positional Arguments

Python prototype (for reference only):

unregisterPageLocked(m) -> None