Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
5131619a
Commit
5131619a
authored
Aug 02, 2018
by
Pierre Jeambrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(stitching): Add Sift support for the FeaturesFinder
parent
b056ce33
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
1 deletion
+49
-1
matchers.hpp
...s/stitching/include/opencv2/stitching/detail/matchers.hpp
+15
-0
matchers.cpp
modules/stitching/src/matchers.cpp
+30
-0
stitching_detailed.cpp
samples/cpp/stitching_detailed.cpp
+4
-1
No files found.
modules/stitching/include/opencv2/stitching/detail/matchers.hpp
View file @
5131619a
...
@@ -137,6 +137,21 @@ private:
...
@@ -137,6 +137,21 @@ private:
Ptr
<
Feature2D
>
surf
;
Ptr
<
Feature2D
>
surf
;
};
};
/** @brief SIFT features finder.
@sa detail::FeaturesFinder, SIFT
*/
class
CV_EXPORTS
SiftFeaturesFinder
:
public
FeaturesFinder
{
public
:
SiftFeaturesFinder
();
private
:
void
find
(
InputArray
image
,
ImageFeatures
&
features
)
CV_OVERRIDE
;
Ptr
<
Feature2D
>
sift
;
};
/** @brief ORB features finder. :
/** @brief ORB features finder. :
@sa detail::FeaturesFinder, ORB
@sa detail::FeaturesFinder, ORB
...
...
modules/stitching/src/matchers.cpp
View file @
5131619a
...
@@ -51,6 +51,7 @@ using namespace cv::cuda;
...
@@ -51,6 +51,7 @@ using namespace cv::cuda;
#ifdef HAVE_OPENCV_XFEATURES2D
#ifdef HAVE_OPENCV_XFEATURES2D
#include "opencv2/xfeatures2d.hpp"
#include "opencv2/xfeatures2d.hpp"
using
xfeatures2d
::
SURF
;
using
xfeatures2d
::
SURF
;
using
xfeatures2d
::
SIFT
;
#endif
#endif
#ifdef HAVE_OPENCV_CUDAIMGPROC
#ifdef HAVE_OPENCV_CUDAIMGPROC
...
@@ -480,6 +481,35 @@ void SurfFeaturesFinder::find(InputArray image, ImageFeatures &features)
...
@@ -480,6 +481,35 @@ void SurfFeaturesFinder::find(InputArray image, ImageFeatures &features)
}
}
}
}
SiftFeaturesFinder
::
SiftFeaturesFinder
()
{
#ifdef HAVE_OPENCV_XFEATURES2D
Ptr
<
SIFT
>
sift_
=
SIFT
::
create
();
if
(
!
sift_
)
CV_Error
(
Error
::
StsNotImplemented
,
"OpenCV was built without SIFT support"
);
sift
=
sift_
;
#else
CV_Error
(
Error
::
StsNotImplemented
,
"OpenCV was built without SIFT support"
);
#endif
}
void
SiftFeaturesFinder
::
find
(
InputArray
image
,
ImageFeatures
&
features
)
{
UMat
gray_image
;
CV_Assert
((
image
.
type
()
==
CV_8UC3
)
||
(
image
.
type
()
==
CV_8UC1
));
if
(
image
.
type
()
==
CV_8UC3
)
{
cvtColor
(
image
,
gray_image
,
COLOR_BGR2GRAY
);
}
else
{
gray_image
=
image
.
getUMat
();
}
UMat
descriptors
;
sift
->
detectAndCompute
(
gray_image
,
Mat
(),
features
.
keypoints
,
descriptors
);
features
.
descriptors
=
descriptors
.
reshape
(
1
,
(
int
)
features
.
keypoints
.
size
());
}
OrbFeaturesFinder
::
OrbFeaturesFinder
(
Size
_grid_size
,
int
n_features
,
float
scaleFactor
,
int
nlevels
)
OrbFeaturesFinder
::
OrbFeaturesFinder
(
Size
_grid_size
,
int
n_features
,
float
scaleFactor
,
int
nlevels
)
{
{
grid_size
=
_grid_size
;
grid_size
=
_grid_size
;
...
...
samples/cpp/stitching_detailed.cpp
View file @
5131619a
...
@@ -82,7 +82,7 @@ static void printUsage()
...
@@ -82,7 +82,7 @@ static void printUsage()
"
\n
Motion Estimation Flags:
\n
"
"
\n
Motion Estimation Flags:
\n
"
" --work_megapix <float>
\n
"
" --work_megapix <float>
\n
"
" Resolution for image registration step. The default is 0.6 Mpx.
\n
"
" Resolution for image registration step. The default is 0.6 Mpx.
\n
"
" --features (surf|orb)
\n
"
" --features (surf|orb
|sift
)
\n
"
" Type of features used for images matching. The default is surf.
\n
"
" Type of features used for images matching. The default is surf.
\n
"
" --matcher (homography|affine)
\n
"
" --matcher (homography|affine)
\n
"
" Matcher used for pairwise image matching.
\n
"
" Matcher used for pairwise image matching.
\n
"
...
@@ -430,6 +430,9 @@ int main(int argc, char* argv[])
...
@@ -430,6 +430,9 @@ int main(int argc, char* argv[])
{
{
finder
=
makePtr
<
OrbFeaturesFinder
>
();
finder
=
makePtr
<
OrbFeaturesFinder
>
();
}
}
else
if
(
features_type
==
"sift"
)
{
finder
=
makePtr
<
SiftFeaturesFinder
>
();
}
else
else
{
{
cout
<<
"Unknown 2D features type: '"
<<
features_type
<<
"'.
\n
"
;
cout
<<
"Unknown 2D features type: '"
<<
features_type
<<
"'.
\n
"
;
...
...
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