FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
arrayfire/src/api/cpp/features.cpp at master · arrayfire/arrayfire · GitHub
arrayfire
arrayfire
Repository navigation
Code
Issues
292
(292)
Pull requests
39
(39)
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
arrayfire
/
src
/
api
/
cpp
/
features.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
99 lines (80 loc) · 2.39 KB
Breadcrumbs
arrayfire
/
src
/
api
/
cpp
/
features.cpp
Copy path
File metadata and controls
99 lines (80 loc) · 2.39 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
*******************************************************
*/
#
include
<
af/array.h
>
#
include
<
af/features.h
>
#
include
"
error.hpp
"
#
include
<
utility
>
namespace
af
{
features::features
() : feat{} {
AF_THROW
(
af_create_features
(&feat,
0
)); }
features::features
(
const
size_t
n) : feat{} {
AF_THROW
(
af_create_features
(&feat, (
int
)n));
}
features::features
(af_features f) : feat(f) {}
features::features
(
const
features& other) {
if
(
this
!= &other) {
AF_THROW
(
af_retain_features
(&feat, other.
get
())); }
}
features& features::
operator
=(
const
features& other) {
if
(
this
!= &other) {
AF_THROW
(
af_release_features
(feat));
AF_THROW
(
af_retain_features
(&feat, other.
get
()));
}
return
*
this
;
}
features::features
(features&& other)
: feat(std::exchange(other.feat,
nullptr
)) {}
features& features::
operator
=(features&& other) {
std::swap
(feat, other.
feat
);
return
*
this
;
}
features::~features
() {
//
THOU SHALL NOT THROW IN DESTRUCTORS
if
(feat) {
af_release_features
(feat); }
}
size_t
features::getNumFeatures
()
const
{
dim_t
n =
0
;
AF_THROW
(
af_get_features_num
(&n, feat));
return
n;
}
array
features::getX
()
const
{
af_array x =
0
;
AF_THROW
(
af_get_features_xpos
(&x, feat));
af_array tmp =
0
;
AF_THROW
(
af_retain_array
(&tmp, x));
return
array
(tmp);
}
array
features::getY
()
const
{
af_array y =
0
;
AF_THROW
(
af_get_features_ypos
(&y, feat));
af_array tmp =
0
;
AF_THROW
(
af_retain_array
(&tmp, y));
return
array
(tmp);
}
array
features::getScore
()
const
{
af_array s =
0
;
AF_THROW
(
af_get_features_score
(&s, feat));
af_array tmp =
0
;
AF_THROW
(
af_retain_array
(&tmp, s));
return
array
(tmp);
}
array
features::getOrientation
()
const
{
af_array ori =
0
;
AF_THROW
(
af_get_features_orientation
(&ori, feat));
af_array tmp =
0
;
AF_THROW
(
af_retain_array
(&tmp, ori));
return
array
(tmp);
}
array
features::getSize
()
const
{
af_array s =
0
;
AF_THROW
(
af_get_features_size
(&s, feat));
af_array tmp =
0
;
AF_THROW
(
af_retain_array
(&tmp, s));
return
array
(tmp);
}
af_features
features::get
()
const
{
return
feat; }
};
//
namespace af
Back
|
FazBrowse Home
|
New Git URL