arrayfire.vision module¶
Computer vision functions (FAST, ORB, etc)
arrayfire.vision.
dog
(image,radius1,radius2)[source]¶Difference of gaussians.
- Parameters
- imageaf.Array
A 2D array specifying an image.
- radius1scalar.
The radius of first gaussian kernel.
- radius2scalar.
The radius of second gaussian kernel.
- Returns
- outaf.Array
A multi dimensional array containing the difference of gaussians.
arrayfire.vision.
fast
(image,threshold=20.0,arc_length=9,non_max=True,feature_ratio=0.05,edge=3)[source]¶FAST feature detector.
- Parameters
- imageaf.Array
A 2D array representing an image.
- thresholdscalar. optional. default: 20.0.
FAST threshold for which a pixel of the circle around a central pixel is consdered.
- arc_lengthscalar. optional. default: 9
The minimum length of arc length to be considered. Max length should be 16.
- non_maxBoolean. optional. default: True
A boolean flag specifying if non max suppression has to be performed.
- feature_ratioscalar. optional. default: 0.05 (5%)
Specifies the maximum ratio of features to pixels in the image.
- edgescalar. optional. default: 3.
Specifies the number of edge rows and columns to be ignored.
- Returns
- featuresaf.Features()
Contains the location and score. Orientation and size are not computed.
arrayfire.vision.
gloh
(image,num_layers=3,contrast_threshold=0.04,edge_threshold=10.0,initial_sigma=1.6,double_input=True,intensity_scale=0.00390625,feature_ratio=0.05)[source]¶GLOH feature detector and descriptor.
- Parameters
- imageaf.Array
A 2D array representing an image
- num_layersoptional: integer. Default: 3
Number of layers per octave. The number of octaves is calculated internally.
- contrast_thresholdoptional: float. Default: 0.04
Threshold used to filter out features that have low contrast.
- edge_thresholdoptional: float. Default: 10.0
Threshold used to filter out features that are too edge-like.
- initial_sigmaoptional: float. Default: 1.6
The sigma value used to filter the input image at the first octave.
- double_inputoptional: bool. Default: True
If True, the input image will be scaled to double the size for the first octave.
- intensity_scaleoptional: float. Default: 1.0/255
The inverse of the difference between maximum and minimum intensity values.
- feature_ratiooptional: float. Default: 0.05
Specifies the maximum number of features to detect as a ratio of image pixels.
- Returns
- (features, descriptor)tuple of (af.Features(), af.Array)
descriptor is an af.Array of size N x 272
arrayfire.vision.
hamming_matcher
(query,database,dim=0,num_nearest=1)[source]¶Hamming distance matcher.
- Parameters
- queryaf.Array
A query feature descriptor
- databaseaf.Array
A multi dimensional array containing the feature descriptor database.
- dimscalar. optional. default: 0.
Specifies the dimension along which feature descriptor lies.
- num_nearest: scalar. optional. default: 1.
Specifies the number of nearest neighbors to find.
- Returns
- (location, distance): tuple of af.Array
location and distances of closest matches.
arrayfire.vision.
harris
(image,max_corners=500,min_response=100000.0,sigma=1.0,block_size=0,k_thr=0.04)[source]¶Harris corner detector.
- Parameters
- imageaf.Array
A 2D array specifying an image.
- max_cornersscalar. optional. default: 500.
Specifies the maximum number of corners to be calculated.
- min_responsescalar. optional. default: 1E5
Specifies the cutoff score for a corner to be considered
- sigmascalar. optional. default: 1.0
Specifies the standard deviation of a circular window.
Only used when block_size == 0. Must be >= 0.5 and <= 5.0.
- block_sizescalar. optional. default: 0
Specifies the window size.
- k_thrscalar. optional. default: 0.04
Harris constant. must be >= 0.01
- Returns
- featuresaf.Features()
Contains the location and score. Orientation and size are not computed.
arrayfire.vision.
homography
(x_src,y_src,x_dst,y_dst,htype=<HOMOGRAPHY.RANSAC:0>,ransac_threshold=3.0,iters=1000,out_type=<Dtype.f32:0>)[source]¶Homography estimation
- Parameters
- x_srcaf.Array
A list of x co-ordinates of the source points.
- y_srcaf.Array
A list of y co-ordinates of the source points.
- x_dstaf.Array
A list of x co-ordinates of the destination points.
- y_dstaf.Array
A list of y co-ordinates of the destination points.
- htypeoptional: af.HOMOGRAPHY. Default: HOMOGRAPHY.RANSAC
- htype can be one of
HOMOGRAPHY.RANSAC: RANdom SAmple Consensus will be used to evaluate quality.
HOMOGRAPHY.LMEDS : Least MEDian of Squares is used to evaluate quality.
- ransac_thresholdoptional: scalar. Default: 3.0
Ifhtype is HOMOGRAPHY.RANSAC, it specifies the L2-distance threshold for inliers.
- out_typeoptional. af.Dtype. Default: Dtype.f32.
Specifies the output data type.
- Returns
- (H, inliers)A tuple of (af.Array, integer)
arrayfire.vision.
match_template
(image,template,match_type=<MATCH.SAD:0>)[source]¶Find the closest match of a template in an image.
- Parameters
- imageaf.Array
A multi dimensional array specifying an image or batch of images.
- templateaf.Array
A multi dimensional array specifying a template or batch of templates.
- match_type: optional: af.MATCH. default: af.MATCH.SAD
Specifies the match function metric.
- Returns
- outaf.Array
An array containing the score of the match at each pixel.
arrayfire.vision.
nearest_neighbour
(query,database,dim=0,num_nearest=1,match_type=<MATCH.SSD:3>)[source]¶Nearest Neighbour matcher.
- Parameters
- queryaf.Array
A query feature descriptor
- databaseaf.Array
A multi dimensional array containing the feature descriptor database.
- dimscalar. optional. default: 0.
Specifies the dimension along which feature descriptor lies.
- num_nearest: scalar. optional. default: 1.
Specifies the number of nearest neighbors to find.
- match_type: optional: af.MATCH. default: af.MATCH.SSD
Specifies the match function metric.
- Returns
- (location, distance): tuple of af.Array
location and distances of closest matches.
arrayfire.vision.
orb
(image,threshold=20.0,max_features=400,scale=1.5,num_levels=4,blur_image=False)[source]¶ORB Feature descriptor.
- Parameters
- imageaf.Array
A 2D array representing an image.
- thresholdscalar. optional. default: 20.0.
FAST threshold for which a pixel of the circle around a central pixel is consdered.
- max_featuresscalar. optional. default: 400.
Specifies the maximum number of features to be considered.
- scalescalar. optional. default: 1.5.
Specifies the factor by which images are down scaled at each level.
- num_levlesscalar. optional. default: 4.
Specifies the number of levels used in the image pyramid.
- blur_imageBoolean. optional. default: False.
Flag specifying if the input has to be blurred before computing descriptors.A gaussian filter with sigma = 2 is applied if True.
- Returns
- (features, descriptor)tuple of (af.Features(), af.Array)
descriptor is an af.Array of size N x 8
arrayfire.vision.
sift
(image,num_layers=3,contrast_threshold=0.04,edge_threshold=10.0,initial_sigma=1.6,double_input=True,intensity_scale=0.00390625,feature_ratio=0.05)[source]¶SIFT feature detector and descriptor.
- Parameters
- imageaf.Array
A 2D array representing an image
- num_layersoptional: integer. Default: 3
Number of layers per octave. The number of octaves is calculated internally.
- contrast_thresholdoptional: float. Default: 0.04
Threshold used to filter out features that have low contrast.
- edge_thresholdoptional: float. Default: 10.0
Threshold used to filter out features that are too edge-like.
- initial_sigmaoptional: float. Default: 1.6
The sigma value used to filter the input image at the first octave.
- double_inputoptional: bool. Default: True
If True, the input image will be scaled to double the size for the first octave.
- intensity_scaleoptional: float. Default: 1.0/255
The inverse of the difference between maximum and minimum intensity values.
- feature_ratiooptional: float. Default: 0.05
Specifies the maximum number of features to detect as a ratio of image pixels.
- Returns
- (features, descriptor)tuple of (af.Features(), af.Array)
descriptor is an af.Array of size N x 128
arrayfire.vision.
susan
(image,radius=3,diff_thr=32,geom_thr=10,feature_ratio=0.05,edge=3)[source]¶SUSAN corner detector.
- Parameters
- imageaf.Array
A 2D array specifying an image.
- radiusscalar. optional. default: 500.
Specifies the radius of each pixel neighborhood.
- diff_thrscalar. optional. default: 1E5
Specifies the intensity difference threshold.
- geom_thrscalar. optional. default: 1.0
Specifies the geometric threshold.
- feature_ratioscalar. optional. default: 0.05 (5%)
Specifies the ratio of corners found to number of pixels.
- edgescalar. optional. default: 3
Specifies the number of edge rows and columns that are ignored.
- Returns
- featuresaf.Features()
Contains the location and score. Orientation and size are not computed.