Do more. Code less. Free software for GPU computing.
<scroll to top>
Namespaces | Enumerations | Functions

image.h File Reference

#include <cuComplex.h>
#include "defines.h"

Go to the source code of this file.

Namespaces

namespace  af

Enumerations

enum  af_morph_t {
  AF_BW_Dilate = 0, AF_BW_Erode, AF_BW_Open, AF_BW_Close,
  AF_BW_Diag, AF_BW_Remove, AF_BW_Fill, AF_BW_Tophat,
  AF_BW_Bothat, AF_BW_Hbreak, AF_BW_Endpoints, AF_BW_Majority,
  AF_BW_Clean
}
 

Image Morphology enum.

More...
enum  af_resize_t { AF_RSZ_Nearest = 0, AF_RSZ_Bilinear = 1 }
 

Resize interpolation method.

More...

Functions

array filter (const array &image, const array &kernel)
 Image Filter.
array rotate (const array &image, const float theta, bool iscrop=true)
 Image rotation.
array erode (const array &image, const array &mask)
 Image erosion.
array dilate (const array &image, const array &mask)
 Image dilation.
array morph (const array &image, af_morph_t type)
 Image morphology (binary)
array resize (const array &image, float scale, af_resize_t type=AF_RSZ_Nearest)
 Resize an image uniformly.
array resize (const array &image, float height, float width, af_resize_t type=AF_RSZ_Nearest)
 Resize an image.
array rgbtogray (const array &image)
 Image grayscale conversion.
array histogram (const array &data, unsigned nbins)
 Histogram of all values in data.
array histogram (const array &data, unsigned nbins, float min, float max)
 Histogram of all values in data.
array histequal (const array &data, const array &histogram)
 Data normalization via histogram equalization.
array medfilt (const array &image, const unsigned height=3, const unsigned width=3)
 Median filtering within window (default 3x3)
Device pointer interface: Image filtering.
Parameters:
[out]d_outThe filtered output
[in]xiNumber of rows in input image
[in]yiNumber of columns in input image
[in]d_inInput image
[in]xfNumber of rows in the input filter
[in]yfNumber of columns in the input filter
[in]d_filterInput filter (on device)
[in]typeused to specify behavior near the boundaries -{Symmetric(1), Repeating(2), Circular(3), Value(4)}
[in]valueif type=4, this value is used for out of bounds
[in]convtrue for convolution, false for correlation
[in]fulltrue for full convolution, false otherwise
[in]batchANumber of input images (gfor)
[in]batchFNumber of input filters (gfor)
afError af_filter_S (float *d_out, unsigned xi, unsigned yi, const float *d_in, unsigned xf, unsigned yf, const float *d_filter, unsigned type, float value, bool conv, bool full, unsigned batchA, unsigned batchF)
 Single precision, Image filtering.
afError af_filter_D (double *d_out, unsigned xi, unsigned yi, const double *d_in, unsigned xf, unsigned yf, const double *d_filter, unsigned type, float value, bool conv, bool full, unsigned batchA, unsigned batchF)
 Double precision, Image filtering.
Device pointer interface: Image Rotation
Parameters:
[in]xoNumber of rows in the output
[in]yoNumber of columns in the output
[out]d_outThe rotated image
[in]xiNumber of rows in input image
[in]yiNumber of columns in input image
[in]d_inInput image
[in]thetaValue in radians the image is to be rotated
[in]batchNumber of input images (1)
afError af_rotate_S (float *d_out, unsigned xo, unsigned yo, const float *d_in, unsigned xi, unsigned yi, float theta, unsigned batch)
 Single precision, Image Rotation.
Device pointer interface: Image Erosion
Parameters:
[out]d_outThe eroded image
[in]mINumber of rows in input image
[in]nINumber of columns in input image
[in]d_inInput image
[in]mHNumber of rows in neigenhborhood patch
[in]nHNumber of columns in neigenhborhood patch
[in]h_nhoodneigenhborhood patch (on host)
[in]batchNumber of input images (1 or ngfor)
afError af_erode_S (float *d_out, unsigned mI, unsigned nI, const float *d_in, unsigned mH, unsigned nH, const float *h_nhood, unsigned batch)
 Single precision, Image Erosion.
afError af_erode_D (double *d_out, unsigned mI, unsigned nI, const double *d_in, unsigned mH, unsigned nH, const float *h_nhood, unsigned batch)
 Double precision, Image Erosion.
Device pointer interface: Image Dilation
Parameters:
[out]d_outThe dilated image
[in]mINumber of rows in input image
[in]nINumber of columns in input image
[in]d_inInput image
[in]mHNumber of rows in neigenhborhood patch
[in]nHNumber of columns in neigenhborhood patch
[in]h_nhoodneigenhborhood patch (on host)
[in]batchNumber of input images (1 or ngfor)
afError af_dilate_S (float *d_out, unsigned mI, unsigned nI, const float *d_in, unsigned mH, unsigned nH, const float *h_nhood, unsigned batch)
 Single precision, Image Dilation.
afError af_dilate_D (double *d_out, unsigned mI, unsigned nI, const double *d_in, unsigned mH, unsigned nH, const float *h_nhood, unsigned batch)
 Double precision, Image Dilation.
Device pointer interface: Binary Image Morphology
Parameters:
[out]d_outThe ouput binary image
[in]mINumber of rows in input image
[in]nINumber of columns in input image
[in]d_inInput binary image
[in]optsspecifies type of image morphology
[in]Nnumber of times the operation is to be applied (ignored).
[in]batchNumber of input images (1 or ngfor)
afError af_morph_B (bool *d_out, unsigned mI, unsigned nI, const bool *d_in, af_morph_t opts, unsigned N, unsigned batch)
 Logical image morph.
Device pointer interface: Image Resize
Parameters:
[out]d_outThe ouput image
[in]mINumber of rows in *input* image
[in]nINumber of columns in *input* image
[in]d_inInput image
[in]mONumber of rows in *output* image
[in]nONumber of columns in *output* image
[in]typespecifies type of image interpolation {nearest(0), linear(1), bilinear(2), cubic(3)}
Note:
only 'nearest' interpolation type currently supported
afError af_resize_S (float *d_out, unsigned mO, unsigned nO, const float *d_in, unsigned mI, unsigned nI, unsigned type)
 Image resize.
Device pointer interface: RGB to Grayscale Conversion
Parameters:
[out]d_outThe ouput image
[in]mINumber of rows in input image
[in]nINumber of columns in input image
[in]d_inInput image | MxNx3 RGB column major | 3xMxN RGB row major
[in]packedInput image memory layout is row major sequential RGB (1)
Note:
Only 3xMxN packed RGB input -> MxNx1 packed output currently supported.
afError af_rgb2gray_S (float *d_out, unsigned mI, unsigned nI, const float *d_in, unsigned packed)
 Image resize.
Device pointer interface: Image Histogram
Parameters:
[out]d_histCount of occurances - PxN matrix
[in]lengthLength of input matrix d_data - N
[in]d_dataDevice-side vector or matrix - MxN
[in]nbinsNumber of bins in h_bins - P
[in]h_binsHost-side vector indicating center of each bin (can be NULL)
[in]nsetsNumber of rows in input data - M
[in]ngforNumber of gfor passes
[in]minMinimum binned value (eg. 0)
[in]maxMaximum binned value (eg. 255)
Note:
d_hist is: a 1xP vector hist for vector inputs, or a PxN matrix hist for MxN matirx inputs
afError af_histogram_S (float *d_hist, unsigned length, const float *d_data, unsigned nbins, const float *h_bins, unsigned nsets, unsigned ngfor)
 Single-precision histogram calculation.
afError af_histminmax_S (float *d_hist, unsigned len, const float *d_buf, unsigned bins, const float *hdata, unsigned nDataSets, unsigned ngfor, float min, float max)
 Single-precision histogram calculation.
Device pointer interface: Image Histogram Equalization
Parameters:
[out]d_outDevice-side equalized data
[in]lengthLength of input vector d_data (M*N for matrix)
[in]d_dataDevice-side vector or matrix of elements to equalize
[in]nbinsNumber of bins in h_bins
[in]d_dataDevice-side histogram
Note:
Currently only vector input histograms are supported
Only the range [0-255] (256 bins) is supported.
afError af_histequalize_S (float *d_out, unsigned length, const float *d_data, unsigned nbins, const float *d_bins)
 Single-precision histogram normalization.
Device pointer interface: Binary Image CCL
Parameters:
[out]d_outDevice-side output labeled image
[in]mINumber of rows in input image
[in]nINumber of cols in input image
[in]inInput binary image
[in]connConnectivity (4 or 8)
afError af_regions_B (float *out, unsigned mI, unsigned nI, const bool *in, unsigned conn)
 Logical image connected component labeling.
Device pointer interface: Labeled Image Region Properties
Parameters:
[out]outDevice-side output properties vector
[in]nyNumber of rows in input image
[in]nxNumber of cols in input image
[in]LInput labeld image (output of regions)
[in]optProperty id {0:Area,2:Centroid,16:Orientation,27:AxisLenghts}
[in]nregionsNumber of unique labeled regions
Note:
output properties are in vector form, one entry for each region.
'Orientation' and 'AxisLenghts' return a vector of size 2xnregions.
'AxisLenghts' computes major and minor moment axis lenghts for each region.
afError af_regionprops_S (float *out, unsigned ny, unsigned nx, float *L, int opt, unsigned nregions)
 Labeled Image Region Properties.
Device pointer interface: Image Median filtering
Parameters:
[out]d_outOutput buffer to hold the filtered result
[in]d_inInput buffer containing matrix to be filtered
[in]mNumber of rows in input matrix
[in]nNumber of columns in input matrix
[in]h_W2x1 Vector specifying window dimensions to be used
afError af_medfilt_B (char *d_out, unsigned m, unsigned n, const char *d_in, const unsigned *h_W)
 Medfilt: Binary input.
afError af_medfilt_c (unsigned char *d_out, unsigned m, unsigned n, const unsigned char *d_in, const unsigned *h_W)
 Medfilt: 8-bit unsigned int.
afError af_medfilt_I (int *d_out, unsigned m, unsigned n, const int *d_in, const unsigned *h_W)
 Medfilt: int data.
afError af_medfilt_U (unsigned *d_out, unsigned m, unsigned n, const unsigned *d_in, const unsigned *h_W)
 Medfilt: unsigned int data.
afError af_medfilt_S (float *d_out, unsigned m, unsigned n, const float *d_in, const unsigned *h_W)
 Medfilt: single-precision data.
afError af_medfilt_D (double *d_out, unsigned m, unsigned n, const double *d_in, const unsigned *h_W)
 Medfilt: double-precision data.

enum  af_rprops_t { AF_RP_Area = 0, AF_RP_Centroid = 1, AF_RP_Orientation = 2, AF_RP_AxisLengths = 4 }
array regions (const array &image, unsigned connectivity)
 Connected component labeling of a binary image.
array areas (const array &regions)
 Calculate area of each numbered component in regions.
array centroids (const array &regions)
 Calculate centroid of each numbered component in regions.
array moments (const array &regions, af_rprops_t property)
 Calculate property for each numbered component in regions.
void moments (array &areas, array &centroids, const array &regions)
 Calculate both area and centroid for each numbered component in regions.
void moments (array &areas, array &centroids, array &axes, array &orientations, const array &regions)
 Calculate various properties for each numbered component in regions.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines