1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

moved SURF_GPU and VIBE to gpunonfree module

This commit is contained in:
Vladislav Vinogradov
2013-03-15 14:09:39 +04:00
parent abc9ef6809
commit fd7bf0b766
39 changed files with 1317 additions and 413 deletions
+34 -3
View File
@@ -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);