forked from donovan-h-parks/Background-Subtraction-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_params_wrapper.hpp
125 lines (114 loc) · 3.66 KB
/
create_params_wrapper.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#ifndef _CREATE_PARAMS_WRAPPER_HPP_
#define _CREATE_PARAMS_WRAPPER_HPP_
#include "AdaptiveMedianBGS.hpp"
#include "Eigenbackground.hpp"
#include "GrimsonGMM.hpp"
#include "MeanBGS.hpp"
#include "PratiMediodBGS.hpp"
#include "WrenGA.hpp"
#include "ZivkovicAGMM.hpp"
#include "Image.hpp"
#include <cv.h>
#include <cxcore.h>
/**
* @brief Updates ImageBase and IplImage data pointers.
*
* @param updated_image
* @param updated_ipl_image
* @param data_ptr data pointer
* @param step step between adjacent rows in bytes
*/
void set_image_data(
ImageBase* updated_image,
IplImage* updated_ipl_image,
unsigned char* data_ptr, int step)
{
cvSetData(updated_ipl_image, data_ptr, step);
(*updated_image) = updated_ipl_image;
}
using namespace Algorithms::BackgroundSubtraction;
AdaptiveMedianParams CreateAdaptiveMedianParams(int width, int height,
float low_threshold, float high_threshold,
int sampling_rate, int learning_frames)
{
Algorithms::BackgroundSubtraction::AdaptiveMedianParams params;
params.SetFrameSize(width, height);
params.LowThreshold() = low_threshold;
params.HighThreshold() = high_threshold;
params.SamplingRate() = sampling_rate;
params.LearningFrames() = learning_frames;
return params;
}
EigenbackgroundParams CreateEigenbackgroundParams(int width, int height,
float low_threshold, float high_threshold, int history_size, int dims)
{
Algorithms::BackgroundSubtraction::EigenbackgroundParams params;
params.SetFrameSize(width, height);
params.LowThreshold() = low_threshold;
params.HighThreshold() = high_threshold;
params.HistorySize() = history_size;
params.EmbeddedDim() = dims;
return params;
}
GrimsonParams CreateGrimsonGMMParams(int width, int height,
float low_threshold, float high_threshold,
float alpha, float max_modes)
{
Algorithms::BackgroundSubtraction::GrimsonParams params;
params.SetFrameSize(width, height);
params.LowThreshold() = low_threshold;
params.HighThreshold() = high_threshold;
params.Alpha() = alpha;
params.MaxModes() = max_modes;
return params;
}
MeanParams CreateMeanBGSParams(int width, int height,
unsigned int low_threshold, unsigned int high_threshold,
float alpha, int learning_frames)
{
Algorithms::BackgroundSubtraction::MeanParams params;
params.SetFrameSize(width, height);
params.LowThreshold() = low_threshold;
params.HighThreshold() = high_threshold;
params.Alpha() = alpha;
params.LearningFrames() = learning_frames;
return params;
}
PratiParams CreatePratiMediodBGSParams(int width, int height,
unsigned int low_threshold, unsigned int high_threshold,
int weight, int sampling_rate, int history_size)
{
Algorithms::BackgroundSubtraction::PratiParams params;
params.SetFrameSize(width, height);
params.LowThreshold() = low_threshold;
params.HighThreshold() = high_threshold;
params.Weight() = weight;
params.SamplingRate() = sampling_rate;
params.HistorySize() = history_size;
return params;
}
WrenParams CreateWrenGAParams(int width, int height,
float low_threshold, float high_threshold,
float alpha, int learning_frames)
{
Algorithms::BackgroundSubtraction::WrenParams params;
params.SetFrameSize(width, height);
params.LowThreshold() = low_threshold;
params.HighThreshold() = high_threshold;
params.Alpha() = alpha;
params.LearningFrames() = learning_frames;
return params;
}
ZivkovicParams CreateZivkovicAGMMParams(int width, int height,
float low_threshold, float high_threshold,
float alpha, int max_modes)
{
Algorithms::BackgroundSubtraction::ZivkovicParams params;
params.SetFrameSize(width, height);
params.LowThreshold() = low_threshold;
params.HighThreshold() = high_threshold;
params.Alpha() = alpha;
params.MaxModes() = max_modes;
return params;
}
#endif