Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • sugu/camtron
1 result
Select Git revision
Show changes
Showing
with 107 additions and 28 deletions
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc.hpp>
#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3
#include "MotionDetection.hpp"
#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3
#include "graph.h"
#include "MEHistogram.hpp"
#include "MEImage.hpp"
//#if CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9
//#define CV_RGB(r, g, b) cvScalar((b), (g), (r), 0)
//#endif
#define CV_RGB_LEGACY(r, g, b) cvScalar((b), (g), (r), 0)
namespace bgslibrary
{
namespace algorithms
......@@ -1354,20 +1357,20 @@ namespace bgslibrary
{
case sm_Circle:
cvCircle(MaskImage, cvPoint(HUHistogramArea / 2, HUHistogramArea / 2),
CircleRadius, CV_RGB(1, 1, 1), -1);
CircleRadius, CV_RGB_LEGACY(1, 1, 1), -1);
break;
case sm_Square:
cvRectangle(MaskImage,
cvPoint(HUHistogramArea / 2 - SquareSide / 2, HUHistogramArea / 2 - SquareSide / 2),
cvPoint(HUHistogramArea / 2 + SquareSide / 2, HUHistogramArea / 2 + SquareSide / 2),
CV_RGB(1, 1, 1), -1);
CV_RGB_LEGACY(1, 1, 1), -1);
break;
case sm_Ellipse:
cvEllipse(MaskImage, cvPoint(HUHistogramArea / 2, HUHistogramArea / 2),
cvSize(EllipseA, EllipseB), 45, 0, 360,
CV_RGB(1, 1, 1), -1);
CV_RGB_LEGACY(1, 1, 1), -1);
break;
case sm_RandomPixels:
......@@ -1387,7 +1390,7 @@ namespace bgslibrary
default:
cvCircle(MaskImage, cvPoint(HUHistogramArea / 2, HUHistogramArea / 2),
(int)MERound(sqrt((float)DesiredArea / ME_PI_VALUE)), CV_RGB(1, 1, 1), -1);
(int)MERound(sqrt((float)DesiredArea / ME_PI_VALUE)), CV_RGB_LEGACY(1, 1, 1), -1);
break;
}
......
......@@ -3,7 +3,12 @@
#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3
#include <opencv2/imgproc/types_c.h>
//#include <opencv2/opencv.hpp>
//#include <opencv2/imgproc.hpp>
// opencv legacy includes
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/video/tracking_c.h>
#include "MEDefs.hpp"
#include "MEImage.hpp"
......
......@@ -21,7 +21,12 @@ void LBSimpleGaussian::process(const cv::Mat &img_input, cv::Mat &img_output, cv
{
init(img_input, img_output, img_bgmodel);
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9)
IplImage _frame = cvIplImage(img_input);
IplImage *frame = &_frame;
#else
IplImage *frame = new IplImage(img_input);
#endif
if (firstTime) {
int w = cvGetSize(frame).width;
......
......@@ -74,8 +74,14 @@ void MultiCue::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &i
init(img_input, img_output, img_bgmodel);
//--STep1: Background Modeling--//
//IplImage* frame = &IplImage(img_input);
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9)
IplImage _frame = cvIplImage(img_input);
IplImage* frame = &_frame;
#else
IplImage* frame = new IplImage(img_input);
#endif
IplImage* result_image = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 3);
cvSetZero(result_image);
if (g_iFrameCount <= g_iTrainingPeriod) {
......@@ -537,8 +543,14 @@ void MultiCue::GaussianFiltering(IplImage* frame, uchar*** aFilteredFrame) {
cv::GaussianBlur(temp_img, temp_img, cv::Size(7, 7), dSigma);
//Store results into aFilteredFrame[][][]
//IplImage* img = &IplImage(temp_img);
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9)
IplImage _img = cvIplImage(temp_img);
IplImage* img = &_img;
#else
IplImage* img = new IplImage(temp_img);
#endif
//int iWidthStep = img->widthStep;
for (int i = 0; i < g_iRHeight; i++) {
......
......@@ -57,8 +57,13 @@ void MultiLayer::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat
if (status == MLBGS_DETECT)
std::cout << algorithmName + " in DETECT mode" << std::endl;
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9)
IplImage _frame = cvIplImage(img_input);
org_img = &_frame;
#else
org_img = new IplImage(img_input);
#endif
fg_img = cvCreateImage(img_size, org_img->depth, org_img->nChannels);
bg_img = cvCreateImage(img_size, org_img->depth, org_img->nChannels);
......@@ -181,7 +186,12 @@ void MultiLayer::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat
std::cout << algorithmName + " enabled learning in DETECT mode" << std::endl;
}
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9)
IplImage _frame = cvIplImage(img_input);
IplImage* img = &_frame;
#else
IplImage* img = new IplImage(img_input);
#endif
BGS->SetRGBInputImage(img);
BGS->Process();
......
#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3
#include <ctime>
#include <cstdlib>
#include <cstdio>
......@@ -6,12 +9,14 @@
#include <cmath>
#include <iostream>
#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3
#include "CMultiLayerBGS.h"
#include "OpenCvLegacyIncludes.h"
//#if CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9
//#define CV_RGB(r, g, b) cvScalar((b), (g), (r), 0)
//#endif
//#define CV_RGB_LEGACY(r, g, b) cvScalar((b), (g), (r), 0)
using namespace bgslibrary::algorithms::multilayer;
using namespace bgslibrary::algorithms::multilayer::blob;
......@@ -1233,7 +1238,7 @@ void CMultiLayerBGS::GetBgLayerNoImage(IplImage *bg_layer_no_img, CvScalar *laye
rgb[0] = rgb[1] = rgb[2] = 0;
int rgb_idx = 0;
for (int l = 0; l < bg_layer_color_num; l++) {
bg_layer_colors[l] = CV_RGB(rgb[0], rgb[1], rgb[2]);
bg_layer_colors[l] = CV_RGB_LEGACY(rgb[0], rgb[1], rgb[2]);
rgb[rgb_idx] += 200;
rgb[rgb_idx] %= 255;
rgb_idx++;
......
#pragma once
#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3
/*
Since the used fast cross bilateral filter codes can not be compiled under Windows,
we don't use the bilateral filter to remove the noise in the foreground detection
......@@ -18,10 +21,10 @@ step. If you compile it under Linux, please uncomment it.
#include <cmath>
#include <iostream>
#include <opencv2/imgproc.hpp>
//#include <opencv2/imgproc.hpp>
#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3
// opencv legacy includes
#include <opencv2/imgproc/imgproc_c.h>
#include "LocalBinaryPattern.h"
#include "BlobResult.h"
......@@ -32,6 +35,8 @@ step. If you compile it under Linux, please uncomment it.
#include "CrossBilateralFilter.h"
#endif
#define CV_RGB_LEGACY(r, g, b) cvScalar((b), (g), (r), 0)
namespace bgslibrary
{
namespace algorithms
......@@ -134,14 +139,14 @@ namespace bgslibrary
void SetCurrentFrameNumber(unsigned long cur_frame_no);
void GetForegroundMaskImage(IplImage *fg_mask_img);
void GetForegroundImage(IplImage *fg_img, CvScalar bg_color = CV_RGB(0, 255, 0));
void GetForegroundImage(IplImage *fg_img, CvScalar bg_color = CV_RGB_LEGACY(0, 255, 0));
void GetBackgroundImage(IplImage *bk_img);
void GetForegroundProbabilityImage(IplImage* fg_prob_img);
void GetBgLayerNoImage(IplImage *bg_layer_no_img, CvScalar* layer_colors = NULL, int layer_num = 0);
void GetLayeredBackgroundImage(int layered_no, IplImage *layered_bg_img, CvScalar empty_color = CV_RGB(0, 0, 0));
void GetLayeredBackgroundImage(int layered_no, IplImage *layered_bg_img, CvScalar empty_color = CV_RGB_LEGACY(0, 0, 0));
void GetCurrentLayeredBackgroundImage(int layered_no, IplImage *layered_bg_img, IplImage *layered_fg_img = NULL,
CvScalar layered_bg_bk_color = CV_RGB(0, 0, 0), CvScalar layered_fg_color = CV_RGB(255, 0, 0),
CvScalar layered_bg_bk_color = CV_RGB_LEGACY(0, 0, 0), CvScalar layered_fg_color = CV_RGB_LEGACY(255, 0, 0),
int smooth_win = 13, float smooth_sigma = 3.0f, float below_layer_noise = 0.5f, float above_layer_noise = 0.3f, int min_blob_size = 50);
float DistLBP(LBPStruct *LBP1, LBPStruct *LBP2);
void GetColoredBgMultiLayeredImage(IplImage *bg_multi_layer_img, CvScalar *layer_colors);
......
#pragma once
#include <cstdio>
#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3
#include <cstdio>
#include "BGS.h"
#include "OpenCvDataConversion.h"
......
#pragma once
#include <stdio.h>
#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3
#include <stdio.h>
// opencv legacy includes
#include "OpenCvLegacyIncludes.h"
......
......@@ -5,7 +5,6 @@
// opencv legacy includes
#include "opencv2/core/core_c.h"
#include "opencv2/core/types_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#endif
......@@ -20,7 +20,13 @@ T2FGMM_UM::~T2FGMM_UM() {
void T2FGMM_UM::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img_bgmodel)
{
init(img_input, img_output, img_bgmodel);
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9)
IplImage _frame = cvIplImage(img_input);
frame = &_frame;
#else
frame = new IplImage(img_input);
#endif
if (firstTime)
frame_data.ReleaseMemory(false);
......
......@@ -20,7 +20,13 @@ T2FGMM_UV::~T2FGMM_UV() {
void T2FGMM_UV::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img_bgmodel)
{
init(img_input, img_output, img_bgmodel);
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9)
IplImage _frame = cvIplImage(img_input);
frame = &_frame;
#else
frame = new IplImage(img_input);
#endif
if (firstTime)
frame_data.ReleaseMemory(false);
......
......@@ -20,7 +20,13 @@ T2FMRF_UM::~T2FMRF_UM() {
void T2FMRF_UM::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img_bgmodel)
{
init(img_input, img_output, img_bgmodel);
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9)
IplImage _frame = cvIplImage(img_input);
frame = &_frame;
#else
frame = new IplImage(img_input);
#endif
if (firstTime)
frame_data.ReleaseMemory(false);
......
......@@ -20,7 +20,13 @@ T2FMRF_UV::~T2FMRF_UV() {
void T2FMRF_UV::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img_bgmodel)
{
init(img_input, img_output, img_bgmodel);
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9)
IplImage _frame = cvIplImage(img_input);
frame = &_frame;
#else
frame = new IplImage(img_input);
#endif
if (firstTime)
frame_data.ReleaseMemory(false);
......
......@@ -23,7 +23,13 @@ VuMeter::~VuMeter() {
void VuMeter::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img_bgmodel)
{
init(img_input, img_output, img_bgmodel);
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9)
IplImage _frame = cvIplImage(img_input);
frame = &_frame;
#else
frame = new IplImage(img_input);
#endif
if (firstTime) {
bgs.SetAlpha(alpha);
......
......@@ -2,13 +2,18 @@
#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3
//#if CV_MAJOR_VERSION == 3 && CV_SUBMINOR_VERSION >= 9
//#define CV_RGB(r, g, b) cvScalar((b), (g), (r), 0)
//#endif
#define CV_RGB_LEGACY(r, g, b) cvScalar((b), (g), (r), 0)
using namespace bgslibrary::algorithms::dp;
void AdaptiveMedianBGS::Initalize(const BgsParams& param)
{
m_params = (AdaptiveMedianParams&)param;
m_median = cvCreateImage(cvSize(m_params.Width(), m_params.Height()), IPL_DEPTH_8U, 3);
cvSet(m_median.Ptr(), CV_RGB(BACKGROUND, BACKGROUND, BACKGROUND));
cvSet(m_median.Ptr(), CV_RGB_LEGACY(BACKGROUND, BACKGROUND, BACKGROUND));
}
RgbImage* AdaptiveMedianBGS::Background()
......