vision.h
Go to the documentation of this file.
1 /*******************************************************
2  * Copyright (c) 2014, ArrayFire
3  * All rights reserved.
4  *
5  * This file is distributed under 3-clause BSD license.
6  * The complete license agreement can be obtained at:
7  * http://arrayfire.com/licenses/BSD-3-Clause
8  ********************************************************/
9 
10 #pragma once
11 #include <af/defines.h>
12 #include <af/features.h>
13 
14 #ifdef __cplusplus
15 namespace af
16 {
17 class array;
18 
42 AFAPI features fast(const array& in, const float thr=20.0f, const unsigned arc_length=9,
43  const bool non_max=true, const float feature_ratio=0.05f,
44  const unsigned edge=3);
45 
46 #if AF_API_VERSION >= 31
47 
73 AFAPI features harris(const array& in, const unsigned max_corners=500,
74  const float min_response=1e5f, const float sigma=1.f,
75  const unsigned block_size=0, const float k_thr=0.04f);
76 #endif
77 
100 AFAPI void orb(features& feat, array& desc, const array& image,
101  const float fast_thr=20.f, const unsigned max_feat=400,
102  const float scl_fctr=1.5f, const unsigned levels=4,
103  const bool blur_img=false);
104 
105 #if AF_API_VERSION >= 31
106 
137 AFAPI void sift(features& feat, array& desc, const array& in, const unsigned n_layers=3,
138  const float contrast_thr=0.04f, const float edge_thr=10.f,
139  const float init_sigma=1.6f, const bool double_input=true,
140  const float intensity_scale=0.00390625f, const float feature_ratio=0.05f);
141 #endif
142 
143 #if AF_API_VERSION >= 32
144 
175 AFAPI void gloh(features& feat, array& desc, const array& in, const unsigned n_layers=3,
176  const float contrast_thr=0.04f, const float edge_thr=10.f,
177  const float init_sigma=1.6f, const bool double_input=true,
178  const float intensity_scale=0.00390625f, const float feature_ratio=0.05f);
179 #endif
180 
205 AFAPI void hammingMatcher(array& idx, array& dist,
206  const array& query, const array& train,
207  const dim_t dist_dim=0, const unsigned n_dist=1);
208 
209 #if AF_API_VERSION >= 31
210 
247 AFAPI void nearestNeighbour(array& idx, array& dist,
248  const array& query, const array& train,
249  const dim_t dist_dim=0, const unsigned n_dist=1,
250  const af_match_type dist_type = AF_SSD);
251 #endif
252 
268 AFAPI array matchTemplate(const array &searchImg, const array &templateImg, const matchType mType=AF_SAD);
269 
270 #if AF_API_VERSION >= 31
271 
287 AFAPI features susan(const array& in,
288  const unsigned radius=3,
289  const float diff_thr=32.0f,
290  const float geom_thr=10.0f,
291  const float feature_ratio=0.05f,
292  const unsigned edge=3);
293 #endif
294 
295 #if AF_API_VERSION >= 31
296 
306 AFAPI array dog(const array& in, const int radius1, const int radius2);
307 #endif
308 
309 #if AF_API_VERSION >= 32
310 
335 AFAPI void homography(array& H, int& inliers, const array& x_src, const array& y_src,
336  const array& x_dst, const array& y_dst, const af_homography_type htype=AF_HOMOGRAPHY_RANSAC,
337  const float inlier_thr=3.f, const unsigned iterations=1000, const dtype otype=f32);
338 #endif
339 
340 }
341 #endif
342 
343 #ifdef __cplusplus
344 extern "C" {
345 #endif
346 
372  AFAPI af_err af_fast(af_features *out, const af_array in, const float thr, const unsigned arc_length,
373  const bool non_max, const float feature_ratio, const unsigned edge);
374 
375 #if AF_API_VERSION >= 31
376 
402  AFAPI af_err af_harris(af_features *out, const af_array in, const unsigned max_corners,
403  const float min_response, const float sigma,
404  const unsigned block_size, const float k_thr);
405 #endif
406 
429  AFAPI af_err af_orb(af_features *feat, af_array *desc, const af_array in,
430  const float fast_thr, const unsigned max_feat, const float scl_fctr,
431  const unsigned levels, const bool blur_img);
432 
433 #if AF_API_VERSION >= 31
434 
465  AFAPI af_err af_sift(af_features *feat, af_array *desc, const af_array in,
466  const unsigned n_layers, const float contrast_thr, const float edge_thr,
467  const float init_sigma, const bool double_input,
468  const float intensity_scale, const float feature_ratio);
469 #endif
470 
471 #if AF_API_VERSION >= 32
472 
503  AFAPI af_err af_gloh(af_features *feat, af_array *desc, const af_array in,
504  const unsigned n_layers, const float contrast_thr,
505  const float edge_thr, const float init_sigma, const bool double_input,
506  const float intensity_scale, const float feature_ratio);
507 #endif
508 
531  const af_array query, const af_array train,
532  const dim_t dist_dim, const unsigned n_dist);
533 
534 #if AF_API_VERSION >= 31
535 
573  const af_array query, const af_array train,
574  const dim_t dist_dim, const unsigned n_dist,
575  const af_match_type dist_type);
576 #endif
577 
595  AFAPI af_err af_match_template(af_array *out, const af_array search_img,
596  const af_array template_img, const af_match_type m_type);
597 
598 #if AF_API_VERSION >= 31
599 
617  AFAPI af_err af_susan(af_features* out, const af_array in, const unsigned radius,
618  const float diff_thr, const float geom_thr,
619  const float feature_ratio, const unsigned edge);
620 #endif
621 
622 #if AF_API_VERSION >= 31
623 
635  AFAPI af_err af_dog(af_array *out, const af_array in, const int radius1, const int radius2);
636 #endif
637 
638 #if AF_API_VERSION >= 32
639 
666  AFAPI af_err af_homography(af_array *H, int *inliers, const af_array x_src, const af_array y_src,
667  const af_array x_dst, const af_array y_dst,
668  const af_homography_type htype, const float inlier_thr,
669  const unsigned iterations, const af_dtype otype);
670 #endif
671 
672 #ifdef __cplusplus
673 }
674 #endif
af::matchType
af_match_type matchType
Definition: defines.h:554
af_homography
AFAPI af_err af_homography(af_array *H, int *inliers, const af_array x_src, const af_array y_src, const af_array x_dst, const af_array y_dst, const af_homography_type htype, const float inlier_thr, const unsigned iterations, const af_dtype otype)
C Interface wrapper for Homography estimation.
af_harris
AFAPI af_err af_harris(af_features *out, const af_array in, const unsigned max_corners, const float min_response, const float sigma, const unsigned block_size, const float k_thr)
C Interface for Harris corner detector.
dim_t
long long dim_t
Definition: defines.h:56
af_sift
AFAPI af_err af_sift(af_features *feat, af_array *desc, const af_array in, const unsigned n_layers, const float contrast_thr, const float edge_thr, const float init_sigma, const bool double_input, const float intensity_scale, const float feature_ratio)
C++ Interface for SIFT feature detector and descriptor.
AF_SSD
@ AF_SSD
Match based on Sum of Squared Differences (SSD)
Definition: defines.h:323
af::sift
AFAPI void sift(features &feat, array &desc, const array &in, const unsigned n_layers=3, const float contrast_thr=0.04f, const float edge_thr=10.f, const float init_sigma=1.6f, const bool double_input=true, const float intensity_scale=0.00390625f, const float feature_ratio=0.05f)
C++ Interface for SIFT feature detector and descriptor.
af::nearestNeighbour
AFAPI void nearestNeighbour(array &idx, array &dist, const array &query, const array &train, const dim_t dist_dim=0, const unsigned n_dist=1, const af_match_type dist_type=AF_SSD)
C++ interface wrapper for determining the nearest neighbouring points to a given set of points.
af::dtype
af_dtype dtype
Definition: defines.h:549
AFAPI
#define AFAPI
Definition: defines.h:38
AF_SAD
@ AF_SAD
Match based on Sum of Absolute Differences (SAD)
Definition: defines.h:320
af
Definition: algorithm.h:14
af::orb
AFAPI void orb(features &feat, array &desc, const array &image, const float fast_thr=20.f, const unsigned max_feat=400, const float scl_fctr=1.5f, const unsigned levels=4, const bool blur_img=false)
C++ Interface for ORB feature descriptor.
features.h
AF_HOMOGRAPHY_RANSAC
@ AF_HOMOGRAPHY_RANSAC
Computes homography using RANSAC.
Definition: defines.h:406
af_array
void * af_array
Definition: defines.h:240
af_match_type
af_match_type
Definition: defines.h:319
af::dog
AFAPI array dog(const array &in, const int radius1, const int radius2)
C++ Interface wrapper for Difference of Gaussians.
af_dtype
af_dtype
Definition: defines.h:210
af::susan
AFAPI features susan(const array &in, const unsigned radius=3, const float diff_thr=32.0f, const float geom_thr=10.0f, const float feature_ratio=0.05f, const unsigned edge=3)
C++ Interface for SUSAN corner detector.
afcl::array
static af::array array(af::dim4 idims, cl_mem buf, af::dtype type, bool retain=false)
Create an af::array object from an OpenCL cl_mem buffer.
Definition: opencl.h:327
af_features
void * af_features
Definition: features.h:13
af::matchTemplate
AFAPI array matchTemplate(const array &searchImg, const array &templateImg, const matchType mType=AF_SAD)
C++ Interface for image template matching.
af_gloh
AFAPI af_err af_gloh(af_features *feat, af_array *desc, const af_array in, const unsigned n_layers, const float contrast_thr, const float edge_thr, const float init_sigma, const bool double_input, const float intensity_scale, const float feature_ratio)
C++ Interface for SIFT feature detector and GLOH descriptor.
af_orb
AFAPI af_err af_orb(af_features *feat, af_array *desc, const af_array in, const float fast_thr, const unsigned max_feat, const float scl_fctr, const unsigned levels, const bool blur_img)
C Interface for ORB feature descriptor.
af_nearest_neighbour
AFAPI af_err af_nearest_neighbour(af_array *idx, af_array *dist, const af_array query, const af_array train, const dim_t dist_dim, const unsigned n_dist, const af_match_type dist_type)
C++ interface wrapper for determining the nearest neighbouring points to a given set of points.
af_match_template
AFAPI af_err af_match_template(af_array *out, const af_array search_img, const af_array template_img, const af_match_type m_type)
C Interface for image template matching.
af_dog
AFAPI af_err af_dog(af_array *out, const af_array in, const int radius1, const int radius2)
C Interface wrapper for Difference of Gaussians.
af::harris
AFAPI features harris(const array &in, const unsigned max_corners=500, const float min_response=1e5f, const float sigma=1.f, const unsigned block_size=0, const float k_thr=0.04f)
C++ Interface for Harris corner detector.
af::hammingMatcher
AFAPI void hammingMatcher(array &idx, array &dist, const array &query, const array &train, const dim_t dist_dim=0, const unsigned n_dist=1)
C++ Interface wrapper for Hamming matcher.
af::fast
AFAPI features fast(const array &in, const float thr=20.0f, const unsigned arc_length=9, const bool non_max=true, const float feature_ratio=0.05f, const unsigned edge=3)
C++ Interface for FAST feature detector.
af::homography
AFAPI void homography(array &H, int &inliers, const array &x_src, const array &y_src, const array &x_dst, const array &y_dst, const af_homography_type htype=AF_HOMOGRAPHY_RANSAC, const float inlier_thr=3.f, const unsigned iterations=1000, const dtype otype=f32)
C++ Interface for Homography estimation.
af_fast
AFAPI af_err af_fast(af_features *out, const af_array in, const float thr, const unsigned arc_length, const bool non_max, const float feature_ratio, const unsigned edge)
C Interface for FAST feature detector.
af_hamming_matcher
AFAPI af_err af_hamming_matcher(af_array *idx, af_array *dist, const af_array query, const af_array train, const dim_t dist_dim, const unsigned n_dist)
C Interface wrapper for Hamming matcher.
af_susan
AFAPI af_err af_susan(af_features *out, const af_array in, const unsigned radius, const float diff_thr, const float geom_thr, const float feature_ratio, const unsigned edge)
C Interface for SUSAN corner detector.
af_homography_type
af_homography_type
Definition: defines.h:405
af_err
af_err
Definition: defines.h:71
af::gloh
AFAPI void gloh(features &feat, array &desc, const array &in, const unsigned n_layers=3, const float contrast_thr=0.04f, const float edge_thr=10.f, const float init_sigma=1.6f, const bool double_input=true, const float intensity_scale=0.00390625f, const float feature_ratio=0.05f)
C++ Interface for SIFT feature detector and GLOH descriptor.
defines.h
f32
@ f32
32-bit floating point values
Definition: defines.h:211