@@ -194,7 +194,7 @@ class BackgroundSubtractorGMGImpl : public BackgroundSubtractorGMG
194
194
String name_;
195
195
196
196
Mat_<int > nfeatures_;
197
- Mat_<unsigned int > colors_;
197
+ Mat_<int > colors_;
198
198
Mat_<float > weights_;
199
199
200
200
Mat buf_;
@@ -223,7 +223,7 @@ void BackgroundSubtractorGMGImpl::initialize(Size frameSize, double minVal, doub
223
223
nfeatures_.setTo (Scalar::all (0 ));
224
224
}
225
225
226
- static float findFeature (unsigned int color, const unsigned int * colors, const float * weights, int nfeatures)
226
+ static float findFeature (int color, const int * colors, const float * weights, int nfeatures)
227
227
{
228
228
for (int i = 0 ; i < nfeatures; ++i)
229
229
{
@@ -248,7 +248,7 @@ static void normalizeHistogram(float* weights, int nfeatures)
248
248
}
249
249
}
250
250
251
- static bool insertFeature (unsigned int color, float weight, unsigned int * colors, float * weights, int & nfeatures, int maxFeatures)
251
+ static bool insertFeature (int color, float weight, int * colors, float * weights, int & nfeatures, int maxFeatures)
252
252
{
253
253
int idx = -1 ;
254
254
for (int i = 0 ; i < nfeatures; ++i)
@@ -266,7 +266,7 @@ static bool insertFeature(unsigned int color, float weight, unsigned int* colors
266
266
{
267
267
// move feature to beginning of list
268
268
269
- ::memmove (colors + 1 , colors, idx * sizeof (unsigned int ));
269
+ ::memmove (colors + 1 , colors, idx * sizeof (int ));
270
270
::memmove (weights + 1 , weights, idx * sizeof (float ));
271
271
272
272
colors[0 ] = color;
@@ -276,7 +276,7 @@ static bool insertFeature(unsigned int color, float weight, unsigned int* colors
276
276
{
277
277
// discard oldest feature
278
278
279
- ::memmove (colors + 1 , colors, (nfeatures - 1 ) * sizeof(unsigned int ));
279
+ ::memmove (colors + 1 , colors, (nfeatures - 1 ) * sizeof(int ));
280
280
::memmove (weights + 1 , weights, (nfeatures - 1 ) * sizeof(float ));
281
281
282
282
colors[0 ] = color;
@@ -297,7 +297,7 @@ static bool insertFeature(unsigned int color, float weight, unsigned int* colors
297
297
298
298
template <typename T> struct Quantization
299
299
{
300
- static unsigned int apply (const void * src_, int x, int cn, double minVal, double maxVal, int quantizationLevels)
300
+ static int apply (const void * src_, int x, int cn, double minVal, double maxVal, int quantizationLevels)
301
301
{
302
302
const T* src = static_cast <const T*>(src_);
303
303
src += x * cn;
@@ -313,7 +313,7 @@ template <typename T> struct Quantization
313
313
class GMG_LoopBody : public ParallelLoopBody
314
314
{
315
315
public:
316
- GMG_LoopBody (const Mat& frame, const Mat& fgmask, const Mat_<int >& nfeatures, const Mat_<unsigned int >& colors, const Mat_<float >& weights,
316
+ GMG_LoopBody (const Mat& frame, const Mat& fgmask, const Mat_<int >& nfeatures, const Mat_<int >& colors, const Mat_<float >& weights,
317
317
int maxFeatures, double learningRate, int numInitializationFrames, int quantizationLevels, double backgroundPrior, double decisionThreshold,
318
318
double maxVal, double minVal, int frameNum, bool updateBackgroundModel) :
319
319
frame_ (frame), fgmask_(fgmask), nfeatures_(nfeatures), colors_(colors), weights_(weights),
@@ -331,7 +331,7 @@ class GMG_LoopBody : public ParallelLoopBody
331
331
mutable Mat_<uchar> fgmask_;
332
332
333
333
mutable Mat_<int > nfeatures_;
334
- mutable Mat_<unsigned int > colors_;
334
+ mutable Mat_<int > colors_;
335
335
mutable Mat_<float > weights_;
336
336
337
337
int maxFeatures_;
@@ -349,7 +349,7 @@ class GMG_LoopBody : public ParallelLoopBody
349
349
350
350
void GMG_LoopBody::operator () (const Range& range) const
351
351
{
352
- typedef unsigned int (*func_t )(const void * src_, int x, int cn, double minVal, double maxVal, int quantizationLevels);
352
+ typedef int (*func_t )(const void * src_, int x, int cn, double minVal, double maxVal, int quantizationLevels);
353
353
static const func_t funcs[] =
354
354
{
355
355
Quantization<uchar>::apply,
@@ -375,10 +375,10 @@ void GMG_LoopBody::operator() (const Range& range) const
375
375
for (int x = 0 ; x < frame_.cols ; ++x, ++featureIdx)
376
376
{
377
377
int nfeatures = nfeatures_row[x];
378
- unsigned int * colors = colors_[featureIdx];
378
+ int * colors = colors_[featureIdx];
379
379
float * weights = weights_[featureIdx];
380
380
381
- unsigned int newFeatureColor = func (frame_row, x, cn, minVal_, maxVal_, quantizationLevels_);
381
+ int newFeatureColor = func (frame_row, x, cn, minVal_, maxVal_, quantizationLevels_);
382
382
383
383
bool isForeground = false ;
384
384
0 commit comments