diff --git a/package_bgs/ae/NPBGSubtractor.cpp b/package_bgs/ae/NPBGSubtractor.cpp index 0f77a9a225b8ae6a1ae54f716e29575aea5dd50d..935d26ef95da261becb024d62165c2e571c9af46 100644 --- a/package_bgs/ae/NPBGSubtractor.cpp +++ b/package_bgs/ae/NPBGSubtractor.cpp @@ -67,7 +67,7 @@ void BGR2SnGnRn(unsigned char * in_image, unsigned int cols) { unsigned int i; - unsigned int r1,r2,r3; + unsigned int r2,r3; unsigned int r,g,b; double s; diff --git a/package_bgs/bl/SigmaDeltaBGS.cpp b/package_bgs/bl/SigmaDeltaBGS.cpp index 68b74636d53f5d60d8fd4ccedc067f583fe66d60..a9c7914f427dc5cecd75b2fa6e7fa51247096d2b 100644 --- a/package_bgs/bl/SigmaDeltaBGS.cpp +++ b/package_bgs/bl/SigmaDeltaBGS.cpp @@ -43,7 +43,7 @@ void SigmaDeltaBGS::process( unsigned char* tmpBuffer = (unsigned char*)img_output_tmp.data; unsigned char* outBuffer = (unsigned char*)img_output.data; - for (int i = 0; i < img_output.total(); ++i) { + for (size_t i = 0; i < img_output.total(); ++i) { *outBuffer = *tmpBuffer; ++outBuffer; diff --git a/package_bgs/ck/MEImage.cpp b/package_bgs/ck/MEImage.cpp index 9693e9b359e1beebeebcd9661d59f09dfeb9509c..737383447133ee6148d6f384cd7b5ff31ed0cee3 100644 --- a/package_bgs/ck/MEImage.cpp +++ b/package_bgs/ck/MEImage.cpp @@ -1280,7 +1280,7 @@ int MEImage::NeighbourhoodCounter(int startx, int starty, void MEImage::GradientVector(bool smooth, int x, int y, int mask_size, int& result_x, int& result_y) { int Results[8]; - int DiagonalMaskSize = (int)((float)mask_size / sqrt(2)); + int DiagonalMaskSize = (int)((float)mask_size / sqrtf(2)); if (ME_CAST_TO_IPLIMAGE(cvImg)->nChannels > 1) { diff --git a/package_bgs/ck/MotionDetection.cpp b/package_bgs/ck/MotionDetection.cpp index 7fe4b7e2653a0e4c530b9d6d0441f7edd8500b4a..516953880eef4debc1121a2b12693ff26b4b88a1 100644 --- a/package_bgs/ck/MotionDetection.cpp +++ b/package_bgs/ck/MotionDetection.cpp @@ -597,7 +597,9 @@ void MotionDetection::DetectMotionsHU(MEImage& image) void MotionDetection::UpdateModelHU(MEImage& image, MEPixelDataType*** model) { - float CurrentHistogram[HUHistogramBins], CurrentHistogram2[HUHistogramBins]; + float *CurrentHistogram, *CurrentHistogram2; + CurrentHistogram = new float[HUHistogramBins]; + CurrentHistogram2 = new float[HUHistogramBins]; unsigned char *ImgData = image.GetImageData(); int RowWidth = image.GetRowWidth(); int RowStart = (HUImageHeight-1)*RowWidth; @@ -787,6 +789,8 @@ void MotionDetection::UpdateModelHU(MEImage& image, MEPixelDataType*** model) } } + delete[] CurrentHistogram; + delete[] CurrentHistogram2; } @@ -795,7 +799,7 @@ void MotionDetection::UpdateHUPixelData(MEPixelDataType* PixelData, const float int MaxIndex = 0; float MaxValue = -1; bool Replace = true; - float IntersectionResults[HUHistogramsPerPixel]; + float *IntersectionResults = new float[HUHistogramsPerPixel]; PixelData->LifeCycle++; PixelData->BackgroundRate = 0.0; @@ -856,6 +860,7 @@ void MotionDetection::UpdateHUPixelData(MEPixelDataType* PixelData, const float for (int i1 = HUHistogramsPerPixel-1; i1 >= 0; --i1) PixelData->Weights[i1] = PixelData->Weights[i1] / sum; + delete[] IntersectionResults; return; } @@ -928,6 +933,7 @@ void MotionDetection::UpdateHUPixelData(MEPixelDataType* PixelData, const float { PixelData->BackgroundHistogram[(int)Weights[i1][0]] = false; } + delete[] IntersectionResults; } @@ -1308,7 +1314,7 @@ void MotionDetection::SetSampleMaskHU(SampleMaskType mask_type, int desiredarea) IplImage *MaskImage = cvCreateImage(cvSize(HUHistogramArea, HUHistogramArea), 8, 1); int DesiredArea = desiredarea <= 0 ? HUHistogramBins*2 : desiredarea; int CalculationMask[HUHistogramArea][HUHistogramArea]; - int SquareSide = (int)MERound(sqrt(DesiredArea)); + int SquareSide = (int)MERound(sqrtf(DesiredArea)); int CircleRadius = (int)MERound(sqrt((float)DesiredArea / ME_PI_VALUE)); int EllipseA = (int)MERound(HUHistogramArea / 2+1); int EllipseB = (int)MERound(DesiredArea / (EllipseA*1.2*ME_PI_VALUE)); diff --git a/package_bgs/db/imbs.cpp b/package_bgs/db/imbs.cpp index 715d699c117c4dab3c41a270d8f28791e31c8852..f5fc0d0235e3ad026c2990b04f9ce6c677ca05fd 100644 --- a/package_bgs/db/imbs.cpp +++ b/package_bgs/db/imbs.cpp @@ -32,8 +32,8 @@ BackgroundSubtractorIMBS::BackgroundSubtractorIMBS() samplingPeriod = 250.;//500.ms minBinHeight = 2; numSamples = 10; //30 - alpha = 0.65; - beta = 1.15; + alpha = 0.65f; + beta = 1.15f; tau_s = 60.; tau_h = 40.; minArea = 30.; @@ -106,7 +106,7 @@ void BackgroundSubtractorIMBS::initialize(Size frameSize, int frameType) this->numPixels = frameSize.width*frameSize.height; persistenceMap = new unsigned int[numPixels]; - for(int i = 0; i < numPixels; i++) { + for(unsigned int i = 0; i < numPixels; i++) { persistenceMap[i] = 0; } @@ -432,7 +432,7 @@ void BackgroundSubtractorIMBS::createBg(unsigned int bg_sample_number) { sudden_change = false; } - for(int i = 0; i < numPixels; i++) { + for(unsigned int i = 0; i < numPixels; i++) { persistenceMap[i] = 0; } @@ -727,7 +727,7 @@ void BackgroundSubtractorIMBS::getBgModel(BgModel bgModel_copy[], int size) { if(size != numPixels) { return; } - for(int i = 0; i < numPixels; ++i){ + for(unsigned int i = 0; i < numPixels; ++i){ bgModel_copy[i].values = new Vec3b[maxBgBins]; bgModel_copy[i].isValid = new bool[maxBgBins]; bgModel_copy[i].isValid[0] = false; diff --git a/package_bgs/jmo/MultiLayerBGS.cpp b/package_bgs/jmo/MultiLayerBGS.cpp index 38ba6451a6d76cc154cfb0ca5ffb9215a6b3f888..46b4489ab4e09f7fb1b2b0afc0e6fad44ca0c508 100644 --- a/package_bgs/jmo/MultiLayerBGS.cpp +++ b/package_bgs/jmo/MultiLayerBGS.cpp @@ -115,17 +115,17 @@ void MultiLayerBGS::process(const cv::Mat &img_input, cv::Mat &img_output, cv::M max_mode_num = 5; weight_updating_constant = 5.0; texture_weight = 0.5; - bg_mode_percent = 0.6; + bg_mode_percent = 0.6f; pattern_neig_half_size = 4; - pattern_neig_gaus_sigma = 3.0; - bg_prob_threshold = 0.2; - bg_prob_updating_threshold = 0.2; + pattern_neig_gaus_sigma = 3.0f; + bg_prob_threshold = 0.2f; + bg_prob_updating_threshold = 0.2f; robust_LBP_constant = 3; min_noised_angle = 10.0 / 180.0 * PI; //0,01768 - shadow_rate = 0.6; - highlight_rate = 1.2; - bilater_filter_sigma_s = 3.0; - bilater_filter_sigma_r = 0.1; + shadow_rate = 0.6f; + highlight_rate = 1.2f; + bilater_filter_sigma_s = 3.0f; + bilater_filter_sigma_r = 0.1f; } else std::cout << "MultiLayerBGS loading config params" << std::endl; @@ -149,7 +149,7 @@ void MultiLayerBGS::process(const cv::Mat &img_input, cv::Mat &img_output, cv::M { //frame_duration = 1.0 / 30.0; //frame_duration = 1.0 / 25.0; - frame_duration = 1.0 / 10.0; + frame_duration = 1.0f / 10.0f; } BGS->SetFrameRate(frame_duration); @@ -160,7 +160,7 @@ void MultiLayerBGS::process(const cv::Mat &img_input, cv::Mat &img_output, cv::M { mode_learn_rate_per_second = 0.5; weight_learn_rate_per_second = 0.5; - init_mode_weight = 0.05; + init_mode_weight = 0.05f; } else { @@ -174,9 +174,9 @@ void MultiLayerBGS::process(const cv::Mat &img_input, cv::Mat &img_output, cv::M { if (loadDefaultParams) { - mode_learn_rate_per_second = 0.01; - weight_learn_rate_per_second = 0.01; - init_mode_weight = 0.001; + mode_learn_rate_per_second = 0.01f; + weight_learn_rate_per_second = 0.01f; + init_mode_weight = 0.001f; } else { @@ -204,9 +204,9 @@ void MultiLayerBGS::process(const cv::Mat &img_input, cv::Mat &img_output, cv::M status = MLBGS_DETECT; - mode_learn_rate_per_second = 0.01; - weight_learn_rate_per_second = 0.01; - init_mode_weight = 0.001; + mode_learn_rate_per_second = 0.01f; + weight_learn_rate_per_second = 0.01f; + init_mode_weight = 0.001f; BGS->SetParameters(max_mode_num, mode_learn_rate_per_second, weight_learn_rate_per_second, init_mode_weight); diff --git a/package_bgs/lb/BGModelFuzzyGauss.h b/package_bgs/lb/BGModelFuzzyGauss.h index 033eaf318d260cd8bc1c2c459cb3314886c36d8e..98a92e594c4783eca28bb85aba22cb1c2f125bd7 100644 --- a/package_bgs/lb/BGModelFuzzyGauss.h +++ b/package_bgs/lb/BGModelFuzzyGauss.h @@ -43,11 +43,11 @@ namespace lb_library { namespace FuzzyGaussian { - const float ALPHAFUZZYGAUSS = 0.02; - const float THRESHOLDFUZZYGAUSS = 3.5; - const float THRESHOLDBG = 0.5; - const float NOISEFUZZYGAUSS = 50.0; - const float FUZZYEXP = -5.0; + const float ALPHAFUZZYGAUSS = 0.02f; + const float THRESHOLDFUZZYGAUSS = 3.5f; + const float THRESHOLDBG = 0.5f; + const float NOISEFUZZYGAUSS = 50.0f; + const float FUZZYEXP = -5.0f; class BGModelFuzzyGauss : public BGModel { diff --git a/package_bgs/lb/BGModelSom.h b/package_bgs/lb/BGModelSom.h index e95af11fffd5e97a18a040722d25c30cc9ec298d..dcd715819927d69ef0a3831637dea7f57264ca4e 100644 --- a/package_bgs/lb/BGModelSom.h +++ b/package_bgs/lb/BGModelSom.h @@ -55,7 +55,7 @@ namespace lb_library const float EPS1 = 100.0; // model match distance during training const float EPS2 = 20.0; // model match distance const float C1 = 1.0; // learning rate during training - const float C2 = 0.05; // learning rate + const float C2 = 0.05f; // learning rate class BGModelSom : public BGModel { diff --git a/package_bgs/sjn/SJN_MultiCueBGS.cpp b/package_bgs/sjn/SJN_MultiCueBGS.cpp index 7f5bcb0f486b8df0ee7c7a4ba995d4fb1f1c10a9..ba5392b0e3c524b03c5e7da1ffe9aa1a2c8b7274 100644 --- a/package_bgs/sjn/SJN_MultiCueBGS.cpp +++ b/package_bgs/sjn/SJN_MultiCueBGS.cpp @@ -31,7 +31,7 @@ SJN_MultiCueBGS::SJN_MultiCueBGS() : firstTime(true), showOutput(true) g_iT_ModelThreshold = 1; //the threshold for texture-model based BGS. (The parameter tau_T in the paper) g_iC_ModelThreshold = 10; //the threshold for appearance based verification. (The parameter tau_A in the paper) - g_fLearningRate = 0.05; //the learning rate for background models. (The parameter alpha in the paper) + g_fLearningRate = 0.05f; //the learning rate for background models. (The parameter alpha in the paper) g_nTextureTrainVolRange = 15; //the codebook size factor for texture models. (The parameter k in the paper) g_nColorTrainVolRange = 20; //the codebook size factor for color models. (The parameter eta_1 in the paper) diff --git a/package_bgs/tb/FuzzyChoquetIntegral.cpp b/package_bgs/tb/FuzzyChoquetIntegral.cpp index f5d98a8fbd0f221087e757397a5deb49092b4abe..c97e1743e445220616a82f6de99f2d176770b6ee 100644 --- a/package_bgs/tb/FuzzyChoquetIntegral.cpp +++ b/package_bgs/tb/FuzzyChoquetIntegral.cpp @@ -106,14 +106,14 @@ void FuzzyChoquetIntegral::process(const cv::Mat &img_input, cv::Mat &img_output // 3 color components if(option == 1) { - fu.FuzzyMeasureG(0.4, 0.3, 0.3, measureG); + fu.FuzzyMeasureG(0.4f, 0.3f, 0.3f, measureG); fu.getFuzzyIntegralChoquet(sim_texture_f1, sim_color_f3, option, measureG, integral_choquet_f1); } // 2 color components + 1 texture component if(option == 2) { - fu.FuzzyMeasureG(0.6, 0.3, 0.1, measureG); + fu.FuzzyMeasureG(0.6f, 0.3f, 0.1f, measureG); fu.getFuzzyIntegralChoquet(sim_texture_f1, sim_color_f3, option, measureG, integral_choquet_f1); } diff --git a/package_bgs/tb/FuzzySugenoIntegral.cpp b/package_bgs/tb/FuzzySugenoIntegral.cpp index e311d417403b3e756aa0c93633e8195704d74b8f..859f14e91d9707d26b61c4af8d47c00e2aa55284 100644 --- a/package_bgs/tb/FuzzySugenoIntegral.cpp +++ b/package_bgs/tb/FuzzySugenoIntegral.cpp @@ -106,14 +106,14 @@ void FuzzySugenoIntegral::process(const cv::Mat &img_input, cv::Mat &img_output, // 3 color components if(option == 1) { - fu.FuzzyMeasureG(0.4, 0.3, 0.3, measureG); + fu.FuzzyMeasureG(0.4f, 0.3f, 0.3f, measureG); fu.getFuzzyIntegralSugeno(sim_texture_f1, sim_color_f3, option, measureG, integral_sugeno_f1); } // 2 color components + 1 texture component if(option == 2) { - fu.FuzzyMeasureG(0.6, 0.3, 0.1, measureG); + fu.FuzzyMeasureG(0.6f, 0.3f, 0.1f, measureG); fu.getFuzzyIntegralSugeno(sim_texture_f1, sim_color_f3, option, measureG, integral_sugeno_f1); } diff --git a/package_bgs/tb/MRF.cpp b/package_bgs/tb/MRF.cpp index fcd3f48f41c43914b355bc350408efb8d13cbd25..cfde8af470bdfdb588d9be501639738709be254a 100644 --- a/package_bgs/tb/MRF.cpp +++ b/package_bgs/tb/MRF.cpp @@ -309,7 +309,6 @@ double MRF_TC::LocalEnergy2(int i, int j, int label) void MRF_TC::ICM2() { int i, j; - int r; //double summa_deltaE = 0; double localenergy0 = 0, localenergy1 = 0; diff --git a/package_bgs/tb/T2FGMM_UM.cpp b/package_bgs/tb/T2FGMM_UM.cpp index aaf280f3cac0f78661cceb6479162b4af0643fb3..1f92ba6fcf0c69b321878abbdeccfb1718dba2e0 100644 --- a/package_bgs/tb/T2FGMM_UM.cpp +++ b/package_bgs/tb/T2FGMM_UM.cpp @@ -16,7 +16,7 @@ along with BGSLibrary. If not, see <http://www.gnu.org/licenses/>. */ #include "T2FGMM_UM.h" -T2FGMM_UM::T2FGMM_UM() : firstTime(true), frameNumber(0), showOutput(true), threshold(9.0), alpha(0.01), gaussians(3), km(1.5), kv(0.6) +T2FGMM_UM::T2FGMM_UM() : firstTime(true), frameNumber(0), showOutput(true), threshold(9.0), alpha(0.01), gaussians(3), km(1.5f), kv(0.6f) { std::cout << "T2FGMM_UM()" << std::endl; } diff --git a/package_bgs/tb/T2FGMM_UV.cpp b/package_bgs/tb/T2FGMM_UV.cpp index 6094fe30d9dce9d74672bf44b4d80384e56b1bfd..3b99dd637d85d57cae2b92f53d4856a2a3fdd738 100644 --- a/package_bgs/tb/T2FGMM_UV.cpp +++ b/package_bgs/tb/T2FGMM_UV.cpp @@ -16,7 +16,7 @@ along with BGSLibrary. If not, see <http://www.gnu.org/licenses/>. */ #include "T2FGMM_UV.h" -T2FGMM_UV::T2FGMM_UV() : firstTime(true), frameNumber(0), showOutput(true), threshold(9.0), alpha(0.01), gaussians(3), km(1.5), kv(0.6) +T2FGMM_UV::T2FGMM_UV() : firstTime(true), frameNumber(0), showOutput(true), threshold(9.0), alpha(0.01), gaussians(3), km(1.5f), kv(0.6f) { std::cout << "T2FGMM_UV()" << std::endl; } diff --git a/package_bgs/tb/T2FMRF.cpp b/package_bgs/tb/T2FMRF.cpp index 945a904a9a9b9c00fd4d2db54619a2be0b35dae7..372f564fe434ec0d9010e644cf8a8f2f65d32c87 100644 --- a/package_bgs/tb/T2FMRF.cpp +++ b/package_bgs/tb/T2FMRF.cpp @@ -116,11 +116,11 @@ void T2FMRF::InitModel(const RgbImage& data) for (unsigned int j = 0; j < m_params.Size(); ++j) { m_state[j].State = background; - m_state[j].Ab2b = 0.7; - m_state[j].Ab2f = 0.3; - m_state[j].Af2b = 0.4; - m_state[j].Af2f = 0.6; - m_state[j].T = 0.7; + m_state[j].Ab2b = 0.7f; + m_state[j].Ab2f = 0.3f; + m_state[j].Af2b = 0.4f; + m_state[j].Af2f = 0.6f; + m_state[j].T = 0.7f; } } diff --git a/package_bgs/tb/T2FMRF_UM.cpp b/package_bgs/tb/T2FMRF_UM.cpp index cf7b5d84f2539787d04874bee6bff458d2caf4bb..439cc53af1adbedc5bb51ff595d997af6a88a6db 100644 --- a/package_bgs/tb/T2FMRF_UM.cpp +++ b/package_bgs/tb/T2FMRF_UM.cpp @@ -17,7 +17,7 @@ along with BGSLibrary. If not, see <http://www.gnu.org/licenses/>. #include "T2FMRF_UM.h" T2FMRF_UM::T2FMRF_UM() : firstTime(true), frameNumber(0), showOutput(true), threshold(9.0), alpha(0.01), -gaussians(3), km(2), kv(0.9) +gaussians(3), km(2.f), kv(0.9f) { std::cout << "T2FMRF_UM()" << std::endl; } diff --git a/package_bgs/tb/T2FMRF_UV.cpp b/package_bgs/tb/T2FMRF_UV.cpp index da9984dfae1b0887b6d0dd6972cb85146ab7176a..0ada1f7fa7488018bc268b8f59f01531529e5467 100644 --- a/package_bgs/tb/T2FMRF_UV.cpp +++ b/package_bgs/tb/T2FMRF_UV.cpp @@ -17,7 +17,7 @@ along with BGSLibrary. If not, see <http://www.gnu.org/licenses/>. #include "T2FMRF_UV.h" T2FMRF_UV::T2FMRF_UV() : firstTime(true), frameNumber(0), showOutput(true), threshold(9.0), alpha(0.01), -gaussians(3), km(2), kv(0.9) +gaussians(3), km(2.f), kv(0.9f) { std::cout << "T2FMRF_UV()" << std::endl; }