moved SURF_GPU and VIBE to gpunonfree module
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
SET(OPENCV_GPU_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc opencv_highgui
|
||||
opencv_ml opencv_video opencv_objdetect opencv_features2d
|
||||
opencv_calib3d opencv_legacy opencv_contrib opencv_gpu
|
||||
opencv_nonfree opencv_superres)
|
||||
opencv_superres)
|
||||
|
||||
ocv_check_dependencies(${OPENCV_GPU_SAMPLES_REQUIRED_DEPS})
|
||||
|
||||
@@ -17,6 +17,10 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
||||
"${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia/core"
|
||||
)
|
||||
|
||||
if(HAVE_opencv_gpunonfree)
|
||||
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpunonfree/include")
|
||||
endif()
|
||||
|
||||
if(HAVE_CUDA)
|
||||
ocv_include_directories(${CUDA_INCLUDE_DIRS})
|
||||
endif()
|
||||
@@ -33,6 +37,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
||||
add_executable(${the_target} ${srcs})
|
||||
|
||||
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_GPU_SAMPLES_REQUIRED_DEPS})
|
||||
if(HAVE_opencv_gpunonfree)
|
||||
target_link_libraries(${the_target} opencv_gpunonfree)
|
||||
endif()
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES
|
||||
OUTPUT_NAME "${project}-example-${name}"
|
||||
|
@@ -1,10 +1,15 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/gpu/gpu.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCV_GPUNONFREE
|
||||
#include "opencv2/gpunonfree/gpunonfree.hpp"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::gpu;
|
||||
@@ -14,7 +19,9 @@ enum Method
|
||||
FGD_STAT,
|
||||
MOG,
|
||||
MOG2,
|
||||
#ifdef HAVE_OPENCV_GPUNONFREE
|
||||
VIBE,
|
||||
#endif
|
||||
GMG
|
||||
};
|
||||
|
||||
@@ -38,13 +45,25 @@ int main(int argc, const char** argv)
|
||||
string file = cmd.get<string>("file");
|
||||
string method = cmd.get<string>("method");
|
||||
|
||||
if (method != "fgd" && method != "mog" && method != "mog2" && method != "vibe" && method != "gmg")
|
||||
if (method != "fgd"
|
||||
&& method != "mog"
|
||||
&& method != "mog2"
|
||||
#ifdef HAVE_OPENCV_GPUNONFREE
|
||||
&& method != "vibe"
|
||||
#endif
|
||||
&& method != "gmg")
|
||||
{
|
||||
cerr << "Incorrect method" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Method m = method == "fgd" ? FGD_STAT : method == "mog" ? MOG : method == "mog2" ? MOG2 : method == "vibe" ? VIBE : GMG;
|
||||
Method m = method == "fgd" ? FGD_STAT :
|
||||
method == "mog" ? MOG :
|
||||
method == "mog2" ? MOG2 :
|
||||
#ifdef HAVE_OPENCV_GPUNONFREE
|
||||
method == "vibe" ? VIBE :
|
||||
#endif
|
||||
GMG;
|
||||
|
||||
VideoCapture cap;
|
||||
|
||||
@@ -67,7 +86,9 @@ int main(int argc, const char** argv)
|
||||
FGDStatModel fgd_stat;
|
||||
MOG_GPU mog;
|
||||
MOG2_GPU mog2;
|
||||
#ifdef HAVE_OPENCV_GPUNONFREE
|
||||
VIBE_GPU vibe;
|
||||
#endif
|
||||
GMG_GPU gmg;
|
||||
gmg.numInitializationFrames = 40;
|
||||
|
||||
@@ -93,9 +114,11 @@ int main(int argc, const char** argv)
|
||||
mog2(d_frame, d_fgmask);
|
||||
break;
|
||||
|
||||
#ifdef HAVE_OPENCV_GPUNONFREE
|
||||
case VIBE:
|
||||
vibe.initialize(d_frame);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case GMG:
|
||||
gmg.initialize(d_frame.size());
|
||||
@@ -105,8 +128,14 @@ int main(int argc, const char** argv)
|
||||
namedWindow("image", WINDOW_NORMAL);
|
||||
namedWindow("foreground mask", WINDOW_NORMAL);
|
||||
namedWindow("foreground image", WINDOW_NORMAL);
|
||||
if (m != VIBE && m != GMG)
|
||||
if (m != GMG
|
||||
#ifdef HAVE_OPENCV_GPUNONFREE
|
||||
&& m != VIBE
|
||||
#endif
|
||||
)
|
||||
{
|
||||
namedWindow("mean background image", WINDOW_NORMAL);
|
||||
}
|
||||
|
||||
for(;;)
|
||||
{
|
||||
@@ -136,9 +165,11 @@ int main(int argc, const char** argv)
|
||||
mog2.getBackgroundImage(d_bgimg);
|
||||
break;
|
||||
|
||||
#ifdef HAVE_OPENCV_GPUNONFREE
|
||||
case VIBE:
|
||||
vibe(d_frame, d_fgmask);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case GMG:
|
||||
gmg(d_frame, d_fgmask);
|
||||
|
@@ -73,9 +73,6 @@ GpuMat d_right[2];
|
||||
StereoBM_GPU* bm[2];
|
||||
GpuMat d_result[2];
|
||||
|
||||
// CPU result
|
||||
Mat result;
|
||||
|
||||
static void printHelp()
|
||||
{
|
||||
std::cout << "Usage: driver_api_stereo_multi_gpu --left <left_image> --right <right_image>\n";
|
||||
|
@@ -3,9 +3,17 @@ set(the_target "example_gpu_performance")
|
||||
file(GLOB sources "performance/*.cpp")
|
||||
file(GLOB headers "performance/*.h")
|
||||
|
||||
if(HAVE_opencv_nonfree)
|
||||
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/nonfree/include")
|
||||
endif()
|
||||
|
||||
add_executable(${the_target} ${sources} ${headers})
|
||||
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_GPU_SAMPLES_REQUIRED_DEPS})
|
||||
|
||||
if(HAVE_opencv_gpunonfree)
|
||||
target_link_libraries(${the_target} opencv_gpunonfree opencv_nonfree)
|
||||
endif()
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES
|
||||
OUTPUT_NAME "performance_gpu"
|
||||
PROJECT_LABEL "(EXAMPLE_GPU) performance")
|
||||
|
@@ -4,10 +4,15 @@
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
#include "opencv2/video/video.hpp"
|
||||
#include "opencv2/gpu/gpu.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
#include "opencv2/legacy/legacy.hpp"
|
||||
#include "performance.h"
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#ifdef HAVE_OPENCV_GPUNONFREE
|
||||
#include "opencv2/gpunonfree/gpunonfree.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
@@ -266,6 +271,7 @@ TEST(meanShift)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENCV_GPUNONFREE
|
||||
|
||||
TEST(SURF)
|
||||
{
|
||||
@@ -294,6 +300,8 @@ TEST(SURF)
|
||||
GPU_OFF;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
TEST(FAST)
|
||||
{
|
||||
|
@@ -44,9 +44,6 @@ GpuMat d_right[2];
|
||||
StereoBM_GPU* bm[2];
|
||||
GpuMat d_result[2];
|
||||
|
||||
// CPU result
|
||||
Mat result;
|
||||
|
||||
static void printHelp()
|
||||
{
|
||||
std::cout << "Usage: stereo_multi_gpu --left <image> --right <image>\n";
|
||||
|
@@ -1,9 +1,14 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCV_GPUNONFREE
|
||||
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/gpu/gpu.hpp"
|
||||
#include "opencv2/gpunonfree/gpunonfree.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
@@ -81,3 +86,13 @@ int main(int argc, char* argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cerr << "OpenCV was built without gpunonfree module" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user