Skip to content

Commit

Permalink
Merge pull request opencv#42 from jet47:removed-vibe
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Donchenko committed May 29, 2013
2 parents 97852e0 + daa7d7f commit 929e8b7
Showing 1 changed file with 3 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
#include <stdexcept>
#include <vector>

#include <opencv2/opencv_modules.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/gpu/gpu.hpp>
#include <opencv2/video/video.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#ifdef HAVE_OPENCV_NONFREE
#include <opencv2/nonfree/gpu.hpp>
#endif

#include "utility.hpp"

Expand All @@ -22,16 +18,12 @@ using namespace cv::gpu;
enum Method
{
MOG,
#ifdef HAVE_OPENCV_NONFREE
VIBE,
#endif
METHOD_MAX
};

const char* method_str[] =
{
"MOG",
"VIBE"
"MOG"
};

class App : public BaseApp
Expand Down Expand Up @@ -75,10 +67,6 @@ void App::runAppLogic()
BackgroundSubtractorMOG mog_cpu;
MOG_GPU mog_gpu;

#ifdef HAVE_OPENCV_NONFREE
VIBE_GPU vibe_gpu;
#endif

Mat frame, fgmask, filterBuf, outImg;
GpuMat d_frame, d_fgmask;

Expand All @@ -100,10 +88,6 @@ void App::runAppLogic()
mog_cpu = BackgroundSubtractorMOG();
mog_gpu.release();

#ifdef HAVE_OPENCV_NONFREE
vibe_gpu.release();
#endif

sources_[curSource_]->reset();

reinitialize_ = false;
Expand All @@ -126,14 +110,7 @@ void App::runAppLogic()
mog_cpu(frame, fgmask, 0.01);
break;
}
#ifdef HAVE_OPENCV_NONFREE
case VIBE:
{
if (useGpu_)
vibe_gpu(d_frame, d_fgmask);
break;
}
#endif

default:
;
}
Expand Down Expand Up @@ -186,9 +163,7 @@ void App::displayState(Mat& outImg, double proc_fps, double total_fps)
printText(outImg, txt.str(), i++);

printText(outImg, "Space - switch CUDA / CPU mode", i++, fontColorRed);
#ifdef HAVE_OPENCV_NONFREE
printText(outImg, "M - switch method", i++, fontColorRed);
#endif

if (sources_.size() > 1)
printText(outImg, "N - switch source", i++, fontColorRed);
}
Expand All @@ -198,26 +173,13 @@ void App::processAppKey(int key)
switch (toupper(key & 0xff))
{
case 32 /*space*/:
#ifdef HAVE_OPENCV_NONFREE
if (method_ != VIBE)
#endif
{
useGpu_ = !useGpu_;
reinitialize_ = true;
cout << "Switch mode to " << (useGpu_ ? "CUDA" : "CPU") << endl;
}
break;

#ifdef HAVE_OPENCV_NONFREE
case 'M':
method_ = static_cast<Method>((method_ + 1) % METHOD_MAX);
if (method_ == VIBE)
useGpu_ = true;
reinitialize_ = true;
cout << "Switch method to " << method_str[method_] << endl;
break;
#endif

case 'N':
if (sources_.size() > 1)
{
Expand Down

0 comments on commit 929e8b7

Please sign in to comment.