Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
1c105ce8
Commit
1c105ce8
authored
Jul 09, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1682 from berak:xfeatueres2d_nonfree
parents
bcddb16e
c871e23d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
1 deletion
+49
-1
xfeatures2d.hpp
modules/xfeatures2d/include/opencv2/xfeatures2d.hpp
+1
-1
sift.cpp
modules/xfeatures2d/src/sift.cpp
+11
-0
surf.cpp
modules/xfeatures2d/src/surf.cpp
+12
-0
surf.cuda.cpp
modules/xfeatures2d/src/surf.cuda.cpp
+21
-0
surf.ocl.cpp
modules/xfeatures2d/src/surf.ocl.cpp
+4
-0
No files found.
modules/xfeatures2d/include/opencv2/xfeatures2d.hpp
View file @
1c105ce8
...
@@ -51,7 +51,7 @@ This section describes experimental algorithms for 2d feature detection.
...
@@ -51,7 +51,7 @@ This section describes experimental algorithms for 2d feature detection.
@defgroup xfeatures2d_nonfree Non-free 2D Features Algorithms
@defgroup xfeatures2d_nonfree Non-free 2D Features Algorithms
This section describes two popular algorithms for 2d feature detection, SIFT and SURF, that are
This section describes two popular algorithms for 2d feature detection, SIFT and SURF, that are
known to be patented. Use them at your own risk.
known to be patented.
You need to set the OPENCV_ENABLE_NONFREE option in cmake to use those.
Use them at your own risk.
@defgroup xfeatures2d_match Experimental 2D Features Matching Algorithm
@defgroup xfeatures2d_match Experimental 2D Features Matching Algorithm
...
...
modules/xfeatures2d/src/sift.cpp
View file @
1c105ce8
...
@@ -112,6 +112,8 @@ namespace cv
...
@@ -112,6 +112,8 @@ namespace cv
namespace
xfeatures2d
namespace
xfeatures2d
{
{
#ifdef OPENCV_ENABLE_NONFREE
/*!
/*!
SIFT implementation.
SIFT implementation.
...
@@ -1197,5 +1199,14 @@ void SIFT_Impl::detectAndCompute(InputArray _image, InputArray _mask,
...
@@ -1197,5 +1199,14 @@ void SIFT_Impl::detectAndCompute(InputArray _image, InputArray _mask,
}
}
}
}
#else // ! #ifdef OPENCV_ENABLE_NONFREE
Ptr
<
SIFT
>
SIFT
::
create
(
int
,
int
,
double
,
double
,
double
)
{
CV_Error
(
Error
::
StsNotImplemented
,
"This algorithm is patented and is excluded in this configuration; "
"Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library"
);
}
#endif
}
}
}
}
modules/xfeatures2d/src/surf.cpp
View file @
1c105ce8
...
@@ -115,6 +115,8 @@ namespace cv
...
@@ -115,6 +115,8 @@ namespace cv
namespace
xfeatures2d
namespace
xfeatures2d
{
{
#ifdef OPENCV_ENABLE_NONFREE
static
const
int
SURF_ORI_SEARCH_INC
=
5
;
static
const
int
SURF_ORI_SEARCH_INC
=
5
;
static
const
float
SURF_ORI_SIGMA
=
2.5
f
;
static
const
float
SURF_ORI_SIGMA
=
2.5
f
;
static
const
float
SURF_DESC_SIGMA
=
3.3
f
;
static
const
float
SURF_DESC_SIGMA
=
3.3
f
;
...
@@ -1005,6 +1007,16 @@ Ptr<SURF> SURF::create(double _threshold, int _nOctaves, int _nOctaveLayers, boo
...
@@ -1005,6 +1007,16 @@ Ptr<SURF> SURF::create(double _threshold, int _nOctaves, int _nOctaveLayers, boo
return
makePtr
<
SURF_Impl
>
(
_threshold
,
_nOctaves
,
_nOctaveLayers
,
_extended
,
_upright
);
return
makePtr
<
SURF_Impl
>
(
_threshold
,
_nOctaves
,
_nOctaveLayers
,
_extended
,
_upright
);
}
}
#else // ! #ifdef OPENCV_ENABLE_NONFREE
Ptr
<
SURF
>
SURF
::
create
(
double
,
int
,
int
,
bool
,
bool
)
{
CV_Error
(
Error
::
StsNotImplemented
,
"This algorithm is patented and is excluded in this configuration; "
"Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library"
);
}
#endif
}
}
}
}
modules/xfeatures2d/src/surf.cuda.cpp
View file @
1c105ce8
...
@@ -64,6 +64,26 @@ void cv::cuda::SURF_CUDA::releaseMemory() { throw_no_cuda(); }
...
@@ -64,6 +64,26 @@ void cv::cuda::SURF_CUDA::releaseMemory() { throw_no_cuda(); }
#else // !defined (HAVE_CUDA)
#else // !defined (HAVE_CUDA)
#if (!defined (OPENCV_ENABLE_NONFREE))
#define throw_no_nonfree CV_Error(Error::StsNotImplemented, \
"This algorithm is patented and is excluded in this configuration; " \
"Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library");
cv
::
cuda
::
SURF_CUDA
::
SURF_CUDA
()
{
throw_no_nonfree
}
cv
::
cuda
::
SURF_CUDA
::
SURF_CUDA
(
double
,
int
,
int
,
bool
,
float
,
bool
)
{
throw_no_nonfree
}
int
cv
::
cuda
::
SURF_CUDA
::
descriptorSize
()
const
{
throw_no_nonfree
}
void
cv
::
cuda
::
SURF_CUDA
::
uploadKeypoints
(
const
std
::
vector
<
KeyPoint
>&
,
GpuMat
&
)
{
throw_no_nonfree
}
void
cv
::
cuda
::
SURF_CUDA
::
downloadKeypoints
(
const
GpuMat
&
,
std
::
vector
<
KeyPoint
>&
)
{
throw_no_nonfree
}
void
cv
::
cuda
::
SURF_CUDA
::
downloadDescriptors
(
const
GpuMat
&
,
std
::
vector
<
float
>&
)
{
throw_no_nonfree
}
void
cv
::
cuda
::
SURF_CUDA
::
operator
()(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
)
{
throw_no_nonfree
}
void
cv
::
cuda
::
SURF_CUDA
::
operator
()(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
GpuMat
&
,
bool
)
{
throw_no_nonfree
}
void
cv
::
cuda
::
SURF_CUDA
::
operator
()(
const
GpuMat
&
,
const
GpuMat
&
,
std
::
vector
<
KeyPoint
>&
)
{
throw_no_nonfree
}
void
cv
::
cuda
::
SURF_CUDA
::
operator
()(
const
GpuMat
&
,
const
GpuMat
&
,
std
::
vector
<
KeyPoint
>&
,
GpuMat
&
,
bool
)
{
throw_no_nonfree
}
void
cv
::
cuda
::
SURF_CUDA
::
operator
()(
const
GpuMat
&
,
const
GpuMat
&
,
std
::
vector
<
KeyPoint
>&
,
std
::
vector
<
float
>&
,
bool
)
{
throw_no_nonfree
}
void
cv
::
cuda
::
SURF_CUDA
::
releaseMemory
()
{
throw_no_nonfree
}
#else // OPENCV_ENABLE_NONFREE
namespace
cv
{
namespace
cuda
{
namespace
device
namespace
cv
{
namespace
cuda
{
namespace
device
{
{
namespace
surf
namespace
surf
...
@@ -431,5 +451,6 @@ void cv::cuda::SURF_CUDA::releaseMemory()
...
@@ -431,5 +451,6 @@ void cv::cuda::SURF_CUDA::releaseMemory()
}
}
#endif // !defined (HAVE_CUDA)
#endif // !defined (HAVE_CUDA)
#endif // !defined (OPENCV_ENABLE_NONFREE)
#endif
#endif
modules/xfeatures2d/src/surf.ocl.cpp
View file @
1c105ce8
...
@@ -57,6 +57,8 @@ namespace cv
...
@@ -57,6 +57,8 @@ namespace cv
namespace
xfeatures2d
namespace
xfeatures2d
{
{
#ifdef OPENCV_ENABLE_NONFREE
enum
{
ORI_SEARCH_INC
=
5
,
ORI_LOCAL_SIZE
=
(
360
/
ORI_SEARCH_INC
)
};
enum
{
ORI_SEARCH_INC
=
5
,
ORI_LOCAL_SIZE
=
(
360
/
ORI_SEARCH_INC
)
};
static
inline
int
calcSize
(
int
octave
,
int
layer
)
static
inline
int
calcSize
(
int
octave
,
int
layer
)
...
@@ -463,6 +465,8 @@ bool SURF_OCL::calcOrientation(UMat &keypoints)
...
@@ -463,6 +465,8 @@ bool SURF_OCL::calcOrientation(UMat &keypoints)
return
kerOri
.
run
(
2
,
globalThreads
,
localThreads
,
true
);
return
kerOri
.
run
(
2
,
globalThreads
,
localThreads
,
true
);
}
}
#endif // ! #ifdef OPENCV_ENABLE_NONFREE
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment