diff --git a/package_bgs/ae/NPBGSubtractor.cpp b/package_bgs/ae/NPBGSubtractor.cpp index 935d26ef95da261becb024d62165c2e571c9af46..3f0620f6281e24f6a3eddd34024835bb0adc3b29 100644 --- a/package_bgs/ae/NPBGSubtractor.cpp +++ b/package_bgs/ae/NPBGSubtractor.cpp @@ -902,7 +902,7 @@ void NPBGSubtractor::NPBGSubtraction_Subset_Kernel( double p; double th; - double alpha,beta,beta_over_alpha, betau,betau_over_alpha; + double alpha; alpha= AlphaValue; @@ -954,11 +954,11 @@ void NPBGSubtractor::NPBGSubtraction_Subset_Kernel( unsigned int kerneltablewidth=2*KernelHalfWidth+1; - beta=3.0; // minimum bound on the range. - betau=100.0; + double beta=3.0; // minimum bound on the range. + double betau=100.0; - beta_over_alpha = beta / alpha; - betau_over_alpha = betau / alpha; + double beta_over_alpha = beta / alpha; + double betau_over_alpha = betau / alpha; double brightness_lowerbound = 1-alpha; diff --git a/package_bgs/av/TBackgroundVuMeter.cpp b/package_bgs/av/TBackgroundVuMeter.cpp index 66a483fcee29058490795cb25e6d101e8adf080c..7fade7a5a2a10629df3d63798d347771749d50b2 100644 --- a/package_bgs/av/TBackgroundVuMeter.cpp +++ b/package_bgs/av/TBackgroundVuMeter.cpp @@ -44,13 +44,11 @@ TBackgroundVuMeter::~TBackgroundVuMeter(void) void TBackgroundVuMeter::Clear(void) { - int i; - TBackground::Clear(); if(m_pHist != NULL) { - for(i = 0; i < m_nBinCount; ++i) + for(int i = 0; i < m_nBinCount; ++i) { if(m_pHist[i] != NULL) cvReleaseImage(&m_pHist[i]); @@ -66,7 +64,6 @@ void TBackgroundVuMeter::Clear(void) void TBackgroundVuMeter::Reset(void) { - int i; float fVal = 0.0; TBackground::Reset(); @@ -76,7 +73,7 @@ void TBackgroundVuMeter::Reset(void) // fVal = (m_nBinCount != 0) ? (float)(1.0 / (double)m_nBinCount) : (float)0.0; fVal = 0.0; - for(i = 0; i < m_nBinCount; ++i) + for(int i = 0; i < m_nBinCount; ++i) { if(m_pHist[i] != NULL) { @@ -175,7 +172,6 @@ int TBackgroundVuMeter::SetParameterValue(int nInd, std::string csNew) int TBackgroundVuMeter::Init(IplImage * pSource) { int nErr = 0; - int i; int nbl, nbc; Clear(); @@ -208,7 +204,7 @@ int TBackgroundVuMeter::Init(IplImage * pSource) // creation des images if(!nErr) { - for(i = 0; i < m_nBinCount; ++i) + for(int i = 0; i < m_nBinCount; ++i) { m_pHist[i] = cvCreateImage(cvSize(nbc, nbl), IPL_DEPTH_32F, 1); @@ -229,7 +225,6 @@ bool TBackgroundVuMeter::isInitOk(IplImage * pSource, IplImage *pBackground, Ipl { bool bResult = true; int i; - int nbl, nbc; bResult = TBackground::isInitOk(pSource, pBackground, pMotionMask); @@ -249,8 +244,8 @@ bool TBackgroundVuMeter::isInitOk(IplImage * pSource, IplImage *pBackground, Ipl if(bResult) { - nbl = pSource->height; - nbc = pSource->width; + int nbl = pSource->height; + int nbc = pSource->width; for(i = 0; i < m_nBinCount; ++i) { @@ -265,10 +260,8 @@ bool TBackgroundVuMeter::isInitOk(IplImage * pSource, IplImage *pBackground, Ipl int TBackgroundVuMeter::UpdateBackground(IplImage *pSource, IplImage *pBackground, IplImage *pMotionMask) { int nErr = 0; - int i, l, c, nbl, nbc; unsigned char *ptrs, *ptrb, *ptrm; float *ptr1, *ptr2; - unsigned char v; if(!isInitOk(pSource, pBackground, pMotionMask)) nErr = Init(pSource); @@ -276,24 +269,24 @@ int TBackgroundVuMeter::UpdateBackground(IplImage *pSource, IplImage *pBackgroun if(!nErr) { m_nCount++; - nbc = pSource->width; - nbl = pSource->height; - v = m_nBinSize; + int nbc = pSource->width; + int nbl = pSource->height; + unsigned char v = m_nBinSize; // multiplie tout par alpha - for(i = 0; i < m_nBinCount; ++i) + for(int i = 0; i < m_nBinCount; ++i) cvConvertScale(m_pHist[i], m_pHist[i], m_fAlpha, 0.0); - for(l = 0; l < nbl; ++l) + for(int l = 0; l < nbl; ++l) { ptrs = (unsigned char *)(pSource->imageData + pSource->widthStep * l); ptrm = (unsigned char *)(pMotionMask->imageData + pMotionMask->widthStep * l); ptrb = (unsigned char *)(pBackground->imageData + pBackground->widthStep * l); - for(c = 0; c < nbc; ++c, ptrs++, ptrb++, ptrm++) + for(int c = 0; c < nbc; ++c, ptrs++, ptrb++, ptrm++) { // recherche le bin � augmenter - i = *ptrs / v; + int i = *ptrs / v; if(i < 0 || i >= m_nBinCount) i = 0; @@ -341,7 +334,6 @@ IplImage *TBackgroundVuMeter::CreateTestImg() int TBackgroundVuMeter::UpdateTest(IplImage *pSource, IplImage *pBackground, IplImage *pTest, int nX, int nY, int nInd) { int nErr = 0; - int i, nbl, nbc; float *ptrf; if(pTest == NULL || !isInitOk(pSource, pBackground, pSource)) @@ -349,8 +341,8 @@ int TBackgroundVuMeter::UpdateTest(IplImage *pSource, IplImage *pBackground, Ipl if(!nErr) { - nbl = pTest->height; - nbc = pTest->width; + int nbl = pTest->height; + int nbc = pTest->width; if(nbl != 100 || nbc != m_nBinCount) nErr = 1; @@ -363,7 +355,7 @@ int TBackgroundVuMeter::UpdateTest(IplImage *pSource, IplImage *pBackground, Ipl { cvSetZero(pTest); - for(i = 0; i < m_nBinCount; ++i) + for(int i = 0; i < m_nBinCount; ++i) { ptrf = (float *)(m_pHist[i]->imageData + m_pHist[i]->widthStep * nY); ptrf += nX; diff --git a/package_bgs/sjn/SJN_MultiCueBGS.cpp b/package_bgs/sjn/SJN_MultiCueBGS.cpp index 31275032e30a544e818d2d1bdad64b70a8b2ab82..83db6ec62153ca3a40136dc9df2a3ffbb762dd94 100644 --- a/package_bgs/sjn/SJN_MultiCueBGS.cpp +++ b/package_bgs/sjn/SJN_MultiCueBGS.cpp @@ -207,7 +207,6 @@ void SJN_MultiCueBGS::Destroy() { if (g_bModelMemAllocated == FALSE && g_bNonModelMemAllocated == FALSE) return; - int i, j; short nNeighborNum = g_nNeighborNum; if (g_bModelMemAllocated == TRUE){ @@ -221,28 +220,28 @@ void SJN_MultiCueBGS::Destroy() cvReleaseImage(&g_ResizedFrame); - for (i = 0; i < g_iRHeight; i++){ - for (j = 0; j < g_iRWidth; j++) free(g_aGaussFilteredFrame[i][j]); + for (int i = 0; i < g_iRHeight; i++){ + for (int j = 0; j < g_iRWidth; j++) free(g_aGaussFilteredFrame[i][j]); free(g_aGaussFilteredFrame[i]); } free(g_aGaussFilteredFrame); - for (i = 0; i < g_iRHeight; i++){ - for (j = 0; j < g_iRWidth; j++) free(g_aXYZFrame[i][j]); + for (int i = 0; i < g_iRHeight; i++){ + for (int j = 0; j < g_iRWidth; j++) free(g_aXYZFrame[i][j]); free(g_aXYZFrame[i]); } free(g_aXYZFrame); - for (i = 0; i < g_iRHeight; i++) free(g_aLandmarkArray[i]); + for (int i = 0; i < g_iRHeight; i++) free(g_aLandmarkArray[i]); free(g_aLandmarkArray); - for (i = 0; i < g_iRHeight; i++) free(g_aResizedForeMap[i]); + for (int i = 0; i < g_iRHeight; i++) free(g_aResizedForeMap[i]); free(g_aResizedForeMap); - for (i = 0; i < g_iHeight; i++) free(g_aForegroundMap[i]); + for (int i = 0; i < g_iHeight; i++) free(g_aForegroundMap[i]); free(g_aForegroundMap); - for (i = 0; i < g_iRHeight; i++) free(g_aUpdateMap[i]); + for (int i = 0; i < g_iRHeight; i++) free(g_aUpdateMap[i]); free(g_aUpdateMap); free(g_BoundBoxInfo->m_aLeft); free(g_BoundBoxInfo->m_aRight); free(g_BoundBoxInfo->m_aBottom); free(g_BoundBoxInfo->m_aUpper); @@ -1805,14 +1804,13 @@ void SJN_MultiCueBGS::C_ReleaseColorModelRelatedMemory(){ void SJN_MultiCueBGS::C_CodebookConstruction(uchar* aP, int iPosX, int iPosY, short nTrainVolRange, float fLearningRate, ColorModel* pC){ //Step1: matching - int i, j; short nMatchedIndex; float fNegLearningRate = 1 - fLearningRate; nMatchedIndex = -1; - for (i = 0; i < pC->m_iNumEntries; i++){ + for (int i = 0; i < pC->m_iNumEntries; i++){ //Checking X if (pC->m_Codewords[i]->m_dMean[0] - nTrainVolRange <= aP[0] && aP[0] <= pC->m_Codewords[i]->m_dMean[0] + nTrainVolRange){ @@ -1834,7 +1832,7 @@ void SJN_MultiCueBGS::C_CodebookConstruction(uchar* aP, int iPosX, int iPosY, sh if (pC->m_iElementArraySize == pC->m_iNumEntries){ pC->m_iElementArraySize = pC->m_iElementArraySize + 5; ColorCodeword **temp = (ColorCodeword**)malloc(sizeof(ColorCodeword*)*pC->m_iElementArraySize); - for (j = 0; j < pC->m_iNumEntries; j++){ + for (int j = 0; j < pC->m_iNumEntries; j++){ temp[j] = pC->m_Codewords[j]; pC->m_Codewords[j] = NULL; } @@ -1868,7 +1866,7 @@ void SJN_MultiCueBGS::C_CodebookConstruction(uchar* aP, int iPosX, int iPosY, sh if (pC->m_bID == 1){ //1. m_iMNRL update int iNegTime; - for (i = 0; i < pC->m_iNumEntries; i++){ + for (int i = 0; i < pC->m_iNumEntries; i++){ //m_iMNRL update iNegTime = pC->m_iTotal - pC->m_Codewords[i]->m_iT_last_time + pC->m_Codewords[i]->m_iT_first_time - 1; if (pC->m_Codewords[i]->m_iMNRL < iNegTime) pC->m_Codewords[i]->m_iMNRL = iNegTime;