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
52184c88
Commit
52184c88
authored
Sep 07, 2011
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gpu functionality in stitching module is excluded from Android build
parent
95a3ffd0
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
85 additions
and
33 deletions
+85
-33
CMakeLists.txt
modules/CMakeLists.txt
+4
-4
CMakeLists.txt
modules/stitching/CMakeLists.txt
+5
-1
warpers.hpp
...es/stitching/include/opencv2/stitching/detail/warpers.hpp
+9
-2
blenders.cpp
modules/stitching/src/blenders.cpp
+6
-2
exposure_compensate.cpp
modules/stitching/src/exposure_compensate.cpp
+2
-0
matchers.cpp
modules/stitching/src/matchers.cpp
+14
-4
precomp.hpp
modules/stitching/src/precomp.hpp
+3
-1
warpers.cpp
modules/stitching/src/warpers.cpp
+24
-8
CMakeLists.txt
samples/cpp/CMakeLists.txt
+18
-11
No files found.
modules/CMakeLists.txt
View file @
52184c88
...
...
@@ -28,12 +28,12 @@ endif()
add_subdirectory
(
video
)
if
(
NOT
(
ANDROID OR IOS
))
add_subdirectory
(
gpu
)
endif
()
if
(
NOT IOS
)
add_subdirectory
(
traincascade
)
add_subdirectory
(
haartraining
)
endif
()
if
(
NOT
(
ANDROID OR IOS
))
add_subdirectory
(
gpu
)
add_subdirectory
(
stitching
)
endif
()
modules/stitching/CMakeLists.txt
View file @
52184c88
include_directories
(
"
${
OpenCV_SOURCE_DIR
}
/modules/imgproc/src"
)
# For gcgraph.hpp
define_opencv_module
(
stitching opencv_core opencv_imgproc opencv_features2d opencv_calib3d opencv_gpu opencv_flann opencv_objdetect
)
if
(
ANDROID
)
define_opencv_module
(
stitching opencv_core opencv_imgproc opencv_features2d opencv_calib3d opencv_flann opencv_objdetect
)
else
()
define_opencv_module
(
stitching opencv_core opencv_imgproc opencv_features2d opencv_calib3d opencv_flann opencv_objdetect opencv_gpu
)
endif
()
modules/stitching/include/opencv2/stitching/detail/warpers.hpp
View file @
52184c88
...
...
@@ -44,7 +44,9 @@
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/gpu/gpu.hpp"
#ifndef ANDROID
# include "opencv2/gpu/gpu.hpp"
#endif
namespace
cv
{
namespace
detail
{
...
...
@@ -118,7 +120,7 @@ protected:
void
detectResultRoi
(
Point
&
dst_tl
,
Point
&
dst_br
);
};
#ifndef ANDROID
class
CV_EXPORTS
PlaneWarperGpu
:
public
PlaneWarper
{
public
:
...
...
@@ -129,6 +131,7 @@ public:
private
:
gpu
::
GpuMat
d_xmap_
,
d_ymap_
,
d_dst_
,
d_src_
;
};
#endif
struct
CV_EXPORTS
SphericalProjector
:
ProjectorBase
...
...
@@ -150,6 +153,7 @@ protected:
};
#ifndef ANDROID
class
CV_EXPORTS
SphericalWarperGpu
:
public
SphericalWarper
{
public
:
...
...
@@ -160,6 +164,7 @@ public:
private
:
gpu
::
GpuMat
d_xmap_
,
d_ymap_
,
d_dst_
,
d_src_
;
};
#endif
struct
CV_EXPORTS
CylindricalProjector
:
ProjectorBase
...
...
@@ -183,6 +188,7 @@ protected:
};
#ifndef ANDROID
class
CV_EXPORTS
CylindricalWarperGpu
:
public
CylindricalWarper
{
public
:
...
...
@@ -193,6 +199,7 @@ public:
private
:
gpu
::
GpuMat
d_xmap_
,
d_ymap_
,
d_dst_
,
d_src_
;
};
#endif
}
// namespace detail
}
// namespace cv
...
...
modules/stitching/src/blenders.cpp
View file @
52184c88
...
...
@@ -158,7 +158,11 @@ void FeatherBlender::blend(Mat &dst, Mat &dst_mask)
MultiBandBlender
::
MultiBandBlender
(
int
try_gpu
,
int
num_bands
)
{
setNumBands
(
num_bands
);
#ifndef ANDROID
can_use_gpu_
=
try_gpu
&&
gpu
::
getCudaEnabledDeviceCount
();
#else
can_use_gpu_
=
false
;
#endif
}
...
...
@@ -342,9 +346,9 @@ void createLaplacePyr(const Mat &img, int num_levels, vector<Mat> &pyr)
}
}
void
createLaplacePyrGpu
(
const
Mat
&
img
,
int
num_levels
,
vector
<
Mat
>
&
pyr
)
{
#ifndef ANDROID
pyr
.
resize
(
num_levels
+
1
);
vector
<
gpu
::
GpuMat
>
gpu_pyr
(
num_levels
+
1
);
...
...
@@ -361,9 +365,9 @@ void createLaplacePyrGpu(const Mat &img, int num_levels, vector<Mat> &pyr)
}
pyr
[
num_levels
]
=
gpu_pyr
[
num_levels
];
#endif
}
void
restoreImageFromLaplacePyr
(
vector
<
Mat
>
&
pyr
)
{
if
(
pyr
.
size
()
==
0
)
...
...
modules/stitching/src/exposure_compensate.cpp
View file @
52184c88
...
...
@@ -43,7 +43,9 @@
#include "precomp.hpp"
using
namespace
std
;
#ifndef ANDROID
using
namespace
cv
::
gpu
;
#endif
namespace
cv
{
namespace
detail
{
...
...
modules/stitching/src/matchers.cpp
View file @
52184c88
...
...
@@ -45,7 +45,9 @@
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
::
detail
;
#ifndef ANDROID
using
namespace
cv
::
gpu
;
#endif
namespace
{
...
...
@@ -67,7 +69,7 @@ private:
Ptr
<
DescriptorExtractor
>
extractor_
;
};
#ifndef ANDROID
class
GpuSurfFeaturesFinder
:
public
FeaturesFinder
{
public
:
...
...
@@ -97,6 +99,7 @@ private:
int
num_octaves_
,
num_layers_
;
int
num_octaves_descr_
,
num_layers_descr_
;
};
#endif
void
CpuSurfFeaturesFinder
::
find
(
const
Mat
&
image
,
ImageFeatures
&
features
)
...
...
@@ -108,7 +111,7 @@ void CpuSurfFeaturesFinder::find(const Mat &image, ImageFeatures &features)
extractor_
->
compute
(
gray_image
,
features
.
keypoints
,
features
.
descriptors
);
}
#ifndef ANDROID
void
GpuSurfFeaturesFinder
::
find
(
const
Mat
&
image
,
ImageFeatures
&
features
)
{
CV_Assert
(
image
.
depth
()
==
CV_8U
);
...
...
@@ -141,6 +144,7 @@ void GpuSurfFeaturesFinder::releaseMemory()
keypoints_
.
release
();
descriptors_
.
release
();
}
#endif
//////////////////////////////////////////////////////////////////////////////
...
...
@@ -220,7 +224,7 @@ private:
float
match_conf_
;
};
#ifndef ANDROID
class
GpuMatcher
:
public
FeaturesMatcher
{
public
:
...
...
@@ -235,6 +239,7 @@ private:
GpuMat
train_idx_
,
distance_
,
all_dist_
;
vector
<
vector
<
DMatch
>
>
pair_matches
;
};
#endif
void
CpuMatcher
::
match
(
const
ImageFeatures
&
features1
,
const
ImageFeatures
&
features2
,
MatchesInfo
&
matches_info
)
...
...
@@ -274,7 +279,7 @@ void CpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &feat
}
}
#ifndef ANDROID
void
GpuMatcher
::
match
(
const
ImageFeatures
&
features1
,
const
ImageFeatures
&
features2
,
MatchesInfo
&
matches_info
)
{
matches_info
.
matches
.
clear
();
...
...
@@ -330,6 +335,7 @@ void GpuMatcher::releaseMemory()
all_dist_
.
release
();
vector
<
vector
<
DMatch
>
>
().
swap
(
pair_matches
);
}
#endif
}
// namespace
...
...
@@ -348,9 +354,11 @@ void FeaturesFinder::operator ()(const Mat &image, ImageFeatures &features)
SurfFeaturesFinder
::
SurfFeaturesFinder
(
bool
try_use_gpu
,
double
hess_thresh
,
int
num_octaves
,
int
num_layers
,
int
num_octaves_descr
,
int
num_layers_descr
)
{
#ifndef ANDROID
if
(
try_use_gpu
&&
getCudaEnabledDeviceCount
()
>
0
)
impl_
=
new
GpuSurfFeaturesFinder
(
hess_thresh
,
num_octaves
,
num_layers
,
num_octaves_descr
,
num_layers_descr
);
else
#endif
impl_
=
new
CpuSurfFeaturesFinder
(
hess_thresh
,
num_octaves
,
num_layers
,
num_octaves_descr
,
num_layers_descr
);
}
...
...
@@ -412,9 +420,11 @@ void FeaturesMatcher::operator ()(const vector<ImageFeatures> &features, vector<
BestOf2NearestMatcher
::
BestOf2NearestMatcher
(
bool
try_use_gpu
,
float
match_conf
,
int
num_matches_thresh1
,
int
num_matches_thresh2
)
{
#ifndef ANDROID
if
(
try_use_gpu
&&
getCudaEnabledDeviceCount
()
>
0
)
impl_
=
new
GpuMatcher
(
match_conf
);
else
#endif
impl_
=
new
CpuMatcher
(
match_conf
);
is_thread_safe_
=
impl_
->
isThreadSafe
();
...
...
modules/stitching/src/precomp.hpp
View file @
52184c88
...
...
@@ -66,7 +66,9 @@
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/gpu/gpu.hpp"
#ifndef ANDROID
# include "opencv2/gpu/gpu.hpp"
#endif
#include "gcgraph.hpp"
#endif
modules/stitching/src/warpers.cpp
View file @
52184c88
...
...
@@ -49,13 +49,27 @@ namespace detail {
Ptr
<
Warper
>
Warper
::
createByCameraFocal
(
float
focal
,
int
type
,
bool
try_gpu
)
{
#ifndef ANDROID
bool
can_use_gpu
=
try_gpu
&&
gpu
::
getCudaEnabledDeviceCount
();
if
(
type
==
PLANE
)
return
!
can_use_gpu
?
new
PlaneWarper
(
focal
)
:
new
PlaneWarperGpu
(
focal
);
if
(
type
==
CYLINDRICAL
)
return
!
can_use_gpu
?
new
CylindricalWarper
(
focal
)
:
new
CylindricalWarperGpu
(
focal
);
if
(
type
==
SPHERICAL
)
return
!
can_use_gpu
?
new
SphericalWarper
(
focal
)
:
new
SphericalWarperGpu
(
focal
);
if
(
can_use_gpu
)
{
if
(
type
==
PLANE
)
return
new
PlaneWarperGpu
(
focal
);
if
(
type
==
CYLINDRICAL
)
return
new
CylindricalWarperGpu
(
focal
);
if
(
type
==
SPHERICAL
)
return
new
SphericalWarperGpu
(
focal
);
}
else
#endif
{
if
(
type
==
PLANE
)
return
new
PlaneWarper
(
focal
);
if
(
type
==
CYLINDRICAL
)
return
new
CylindricalWarper
(
focal
);
if
(
type
==
SPHERICAL
)
return
new
SphericalWarper
(
focal
);
}
CV_Error
(
CV_StsBadArg
,
"unsupported warping type"
);
return
NULL
;
}
...
...
@@ -107,7 +121,7 @@ void PlaneWarper::detectResultRoi(Point &dst_tl, Point &dst_br)
dst_br
.
y
=
static_cast
<
int
>
(
br_vf
);
}
#ifndef ANDROID
Point
PlaneWarperGpu
::
warp
(
const
Mat
&
src
,
float
focal
,
const
Mat
&
R
,
Mat
&
dst
,
int
interp_mode
,
int
border_mode
)
{
src_size_
=
src
.
size
();
...
...
@@ -132,6 +146,7 @@ Point PlaneWarperGpu::warp(const Mat &src, float focal, const Mat &R, Mat &dst,
return
dst_tl
;
}
#endif
void
SphericalWarper
::
detectResultRoi
(
Point
&
dst_tl
,
Point
&
dst_br
)
...
...
@@ -177,7 +192,7 @@ void SphericalWarper::detectResultRoi(Point &dst_tl, Point &dst_br)
dst_br
.
y
=
static_cast
<
int
>
(
br_vf
);
}
#ifndef ANDROID
Point
SphericalWarperGpu
::
warp
(
const
Mat
&
src
,
float
focal
,
const
Mat
&
R
,
Mat
&
dst
,
int
interp_mode
,
int
border_mode
)
{
...
...
@@ -230,6 +245,7 @@ Point CylindricalWarperGpu::warp(const Mat &src, float focal, const Mat &R, Mat
return
dst_tl
;
}
#endif
}
// namespace detail
}
// namespace cv
samples/cpp/CMakeLists.txt
View file @
52184c88
...
...
@@ -19,8 +19,10 @@ if (BUILD_EXAMPLES)
"
${
CMAKE_SOURCE_DIR
}
/modules/legacy/include"
"
${
CMAKE_SOURCE_DIR
}
/modules/contrib/include"
"
${
CMAKE_SOURCE_DIR
}
/modules/stitching/include"
"
${
CMAKE_SOURCE_DIR
}
/modules/gpu/include"
)
)
if
(
NOT ANDROID
)
include_directories
(
"
${
CMAKE_SOURCE_DIR
}
/modules/gpu/include"
)
endif
()
if
(
CMAKE_COMPILER_IS_GNUCXX
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wno-unused-function"
)
...
...
@@ -37,19 +39,24 @@ if (BUILD_EXAMPLES)
PROJECT_LABEL
"(EXAMPLE)
${
name
}
"
)
add_dependencies
(
${
the_target
}
opencv_core opencv_flann opencv_imgproc opencv_highgui
opencv_ml opencv_video opencv_objdetect opencv_features2d
opencv_calib3d opencv_legacy opencv_contrib opencv_stitching
opencv_gpu
)
opencv_calib3d opencv_legacy opencv_contrib opencv_stitching
)
target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
opencv_core
opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib opencv_stitching opencv_gpu
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"samples//cpp"
)
endif
()
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib opencv_stitching
)
if
(
NOT ANDROID
)
target_link_libraries
(
${
the_target
}
opencv_gpu
)
add_dependencies
(
${
the_target
}
opencv_gpu
)
endif
()
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"samples//cpp"
)
endif
()
if
(
WIN32
)
if
(
MSVC AND NOT BUILD_SHARED_LIBS
)
set_target_properties
(
${
the_target
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG"
)
endif
()
if
(
MSVC AND NOT BUILD_SHARED_LIBS
)
set_target_properties
(
${
the_target
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG"
)
endif
()
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
"samples/cpp"
COMPONENT main
)
endif
()
...
...
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