From bfc267f982e2c9c7f29c8b2ce01b3d2f433d4e5e Mon Sep 17 00:00:00 2001
From: Andrews Cordolino Sobral <andrewssobral@gmail.com>
Date: Tue, 19 Jul 2022 00:08:55 +0200
Subject: [PATCH] [fix]taking the address of a temporary object

---
 examples/Demo2.cpp                      | 4 ++--
 src/algorithms/DPAdaptiveMedian.cpp     | 2 +-
 src/algorithms/DPEigenbackground.cpp    | 2 +-
 src/algorithms/DPGrimsonGMM.cpp         | 2 +-
 src/algorithms/DPMean.cpp               | 2 +-
 src/algorithms/DPPratiMediod.cpp        | 2 +-
 src/algorithms/DPTexture.cpp            | 2 +-
 src/algorithms/DPWrenGA.cpp             | 2 +-
 src/algorithms/DPZivkovicAGMM.cpp       | 2 +-
 src/algorithms/FuzzyChoquetIntegral.cpp | 8 ++++----
 src/algorithms/FuzzySugenoIntegral.cpp  | 8 ++++----
 src/algorithms/LBAdaptiveSOM.cpp        | 2 +-
 src/algorithms/LBFuzzyAdaptiveSOM.cpp   | 2 +-
 src/algorithms/LBFuzzyGaussian.cpp      | 2 +-
 src/algorithms/LBMixtureOfGaussians.cpp | 2 +-
 src/algorithms/LBSimpleGaussian.cpp     | 2 +-
 src/algorithms/MultiCue.cpp             | 4 ++--
 src/algorithms/MultiLayer.cpp           | 4 ++--
 src/algorithms/T2FGMM_UM.cpp            | 2 +-
 src/algorithms/T2FGMM_UV.cpp            | 2 +-
 src/algorithms/T2FMRF_UM.cpp            | 2 +-
 src/algorithms/T2FMRF_UV.cpp            | 2 +-
 src/algorithms/VuMeter.cpp              | 2 +-
 23 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/examples/Demo2.cpp b/examples/Demo2.cpp
index 2c4b8ad..197d4e0 100644
--- a/examples/Demo2.cpp
+++ b/examples/Demo2.cpp
@@ -22,7 +22,7 @@ int main(int argc, char **argv)
   /* Background Subtraction Methods */
   auto algorithmsName = BGS_Factory::Instance()->GetRegisteredAlgorithmsName();
   
-  std::cout << "List of available algorithms:" << std::endl;
+  std::cout << "List of available algorithms (" << algorithmsName.size() << "):" << std::endl;
   std::copy(algorithmsName.begin(), algorithmsName.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
   
   for (const std::string& algorithmName : algorithmsName)
@@ -40,7 +40,7 @@ int main(int argc, char **argv)
       std::stringstream ss;
       ss << frame_counter;
       auto fileName = baseDir + "/" + ss.str() + ".png";
-      std::cout << "reading " << fileName << std::endl;
+      // std::cout << "reading " << fileName << std::endl;
 
       auto img_input = cv::imread(fileName, CV_LOAD_IMAGE_COLOR);
 
diff --git a/src/algorithms/DPAdaptiveMedian.cpp b/src/algorithms/DPAdaptiveMedian.cpp
index e6fd808..5c34d3f 100644
--- a/src/algorithms/DPAdaptiveMedian.cpp
+++ b/src/algorithms/DPAdaptiveMedian.cpp
@@ -22,7 +22,7 @@ void DPAdaptiveMedian::process(const cv::Mat &img_input, cv::Mat &img_output, cv
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame_data = cvCloneImage(&(IplImage)_frame);
+  frame_data = cvCloneImage(&_frame);
 
   if (firstTime) {
     int width = img_input.size().width;
diff --git a/src/algorithms/DPEigenbackground.cpp b/src/algorithms/DPEigenbackground.cpp
index 2627cdc..9ddc1b9 100644
--- a/src/algorithms/DPEigenbackground.cpp
+++ b/src/algorithms/DPEigenbackground.cpp
@@ -22,7 +22,7 @@ void DPEigenbackground::process(const cv::Mat &img_input, cv::Mat &img_output, c
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame_data = cvCloneImage(&(IplImage)_frame);
+  frame_data = cvCloneImage(&_frame);
 
   if (firstTime) {
     int width = img_input.size().width;
diff --git a/src/algorithms/DPGrimsonGMM.cpp b/src/algorithms/DPGrimsonGMM.cpp
index 3febe64..d9d8e4c 100644
--- a/src/algorithms/DPGrimsonGMM.cpp
+++ b/src/algorithms/DPGrimsonGMM.cpp
@@ -22,7 +22,7 @@ void DPGrimsonGMM::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Ma
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame_data = cvCloneImage(&(IplImage)_frame);
+  frame_data = cvCloneImage(&_frame);
 
   if (firstTime) {
     int width = img_input.size().width;
diff --git a/src/algorithms/DPMean.cpp b/src/algorithms/DPMean.cpp
index 673e9df..cc106fa 100644
--- a/src/algorithms/DPMean.cpp
+++ b/src/algorithms/DPMean.cpp
@@ -22,7 +22,7 @@ void DPMean::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame_data = cvCloneImage(&(IplImage)_frame);
+  frame_data = cvCloneImage(&_frame);
 
   if (firstTime) {
     int width = img_input.size().width;
diff --git a/src/algorithms/DPPratiMediod.cpp b/src/algorithms/DPPratiMediod.cpp
index 12ea039..17c9f98 100644
--- a/src/algorithms/DPPratiMediod.cpp
+++ b/src/algorithms/DPPratiMediod.cpp
@@ -22,7 +22,7 @@ void DPPratiMediod::process(const cv::Mat &img_input, cv::Mat &img_output, cv::M
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame_data = cvCloneImage(&(IplImage)_frame);
+  frame_data = cvCloneImage(&_frame);
 
   if (firstTime) {
     int width = img_input.size().width;
diff --git a/src/algorithms/DPTexture.cpp b/src/algorithms/DPTexture.cpp
index 0959339..ec5dd3e 100644
--- a/src/algorithms/DPTexture.cpp
+++ b/src/algorithms/DPTexture.cpp
@@ -30,7 +30,7 @@ void DPTexture::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame = cvCloneImage(&(IplImage)_frame);
+  frame = cvCloneImage(&_frame);
 
   if (firstTime) {
     width = img_input.size().width;
diff --git a/src/algorithms/DPWrenGA.cpp b/src/algorithms/DPWrenGA.cpp
index 971e4d4..05b35a6 100644
--- a/src/algorithms/DPWrenGA.cpp
+++ b/src/algorithms/DPWrenGA.cpp
@@ -22,7 +22,7 @@ void DPWrenGA::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &i
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame_data = cvCloneImage(&(IplImage)_frame);
+  frame_data = cvCloneImage(&_frame);
 
   if (firstTime) {
     int width = img_input.size().width;
diff --git a/src/algorithms/DPZivkovicAGMM.cpp b/src/algorithms/DPZivkovicAGMM.cpp
index 1d2efbe..a087b4f 100644
--- a/src/algorithms/DPZivkovicAGMM.cpp
+++ b/src/algorithms/DPZivkovicAGMM.cpp
@@ -22,7 +22,7 @@ void DPZivkovicAGMM::process(const cv::Mat &img_input, cv::Mat &img_output, cv::
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame_data = cvCloneImage(&(IplImage)_frame);
+  frame_data = cvCloneImage(&_frame);
 
   if (firstTime) {
     int width = img_input.size().width;
diff --git a/src/algorithms/FuzzyChoquetIntegral.cpp b/src/algorithms/FuzzyChoquetIntegral.cpp
index 808c874..96fa890 100644
--- a/src/algorithms/FuzzyChoquetIntegral.cpp
+++ b/src/algorithms/FuzzyChoquetIntegral.cpp
@@ -74,16 +74,16 @@ void FuzzyChoquetIntegral::process(const cv::Mat &img_input, cv::Mat &img_output
     cv::cvtColor(img_background_f3, img_background_f1, CV_BGR2GRAY);
 
     IplImage _input_f3 = cvIplImage(img_input_f3);
-    IplImage* input_f3 = cvCloneImage(&(IplImage)_input_f3);
+    IplImage* input_f3 = cvCloneImage(&_input_f3);
 
     IplImage _input_f1 = cvIplImage(img_input_f1);
-    IplImage* input_f1 = cvCloneImage(&(IplImage)_input_f1);
+    IplImage* input_f1 = cvCloneImage(&_input_f1);
 
     IplImage _background_f3 = cvIplImage(img_background_f3);
-    IplImage* background_f3 = cvCloneImage(&(IplImage)_background_f3);
+    IplImage* background_f3 = cvCloneImage(&_background_f3);
 
     IplImage _background_f1 = cvIplImage(img_background_f1);
-    IplImage* background_f1 = cvCloneImage(&(IplImage)_background_f1);
+    IplImage* background_f1 = cvCloneImage(&_background_f1);
 
     IplImage* lbp_input_f1 = cvCreateImage(cvSize(input_f1->width, input_f1->height), IPL_DEPTH_32F, 1);
     cvSetZero(lbp_input_f1);
diff --git a/src/algorithms/FuzzySugenoIntegral.cpp b/src/algorithms/FuzzySugenoIntegral.cpp
index 6043d98..a43dfba 100644
--- a/src/algorithms/FuzzySugenoIntegral.cpp
+++ b/src/algorithms/FuzzySugenoIntegral.cpp
@@ -73,16 +73,16 @@ void FuzzySugenoIntegral::process(const cv::Mat &img_input, cv::Mat &img_output,
     cv::cvtColor(img_background_f3, img_background_f1, CV_BGR2GRAY);
 
     IplImage _input_f3 = cvIplImage(img_input_f3);
-    IplImage* input_f3 = cvCloneImage(&(IplImage)_input_f3);
+    IplImage* input_f3 = cvCloneImage(&_input_f3);
 
     IplImage _input_f1 = cvIplImage(img_input_f1);
-    IplImage* input_f1 = cvCloneImage(&(IplImage)_input_f1);
+    IplImage* input_f1 = cvCloneImage(&_input_f1);
 
     IplImage _background_f3 = cvIplImage(img_background_f3);
-    IplImage* background_f3 = cvCloneImage(&(IplImage)_background_f3);
+    IplImage* background_f3 = cvCloneImage(&_background_f3);
 
     IplImage _background_f1 = cvIplImage(img_background_f1);
-    IplImage* background_f1 = cvCloneImage(&(IplImage)_background_f1);
+    IplImage* background_f1 = cvCloneImage(&_background_f1);
 
     IplImage* lbp_input_f1 = cvCreateImage(cvSize(input_f1->width, input_f1->height), IPL_DEPTH_32F, 1);
     cvSetZero(lbp_input_f1);
diff --git a/src/algorithms/LBAdaptiveSOM.cpp b/src/algorithms/LBAdaptiveSOM.cpp
index 76efbc1..afc0292 100644
--- a/src/algorithms/LBAdaptiveSOM.cpp
+++ b/src/algorithms/LBAdaptiveSOM.cpp
@@ -24,7 +24,7 @@ void LBAdaptiveSOM::process(const cv::Mat &img_input, cv::Mat &img_output, cv::M
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  IplImage* frame = cvCloneImage(&(IplImage)_frame);
+  IplImage* frame = cvCloneImage(&_frame);
 
   if (firstTime) {
     int w = img_input.size().width;
diff --git a/src/algorithms/LBFuzzyAdaptiveSOM.cpp b/src/algorithms/LBFuzzyAdaptiveSOM.cpp
index 8fb0ccb..00047af 100644
--- a/src/algorithms/LBFuzzyAdaptiveSOM.cpp
+++ b/src/algorithms/LBFuzzyAdaptiveSOM.cpp
@@ -23,7 +23,7 @@ void LBFuzzyAdaptiveSOM::process(const cv::Mat &img_input, cv::Mat &img_output,
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  IplImage* frame = cvCloneImage(&(IplImage)_frame);
+  IplImage* frame = cvCloneImage(&_frame);
 
   if (firstTime) {
     int w = img_input.size().width;
diff --git a/src/algorithms/LBFuzzyGaussian.cpp b/src/algorithms/LBFuzzyGaussian.cpp
index e175d59..00f3fef 100644
--- a/src/algorithms/LBFuzzyGaussian.cpp
+++ b/src/algorithms/LBFuzzyGaussian.cpp
@@ -23,7 +23,7 @@ void LBFuzzyGaussian::process(const cv::Mat &img_input, cv::Mat &img_output, cv:
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  IplImage* frame = cvCloneImage(&(IplImage)_frame);
+  IplImage* frame = cvCloneImage(&_frame);
 
   if (firstTime) {
     int w = img_input.size().width;
diff --git a/src/algorithms/LBMixtureOfGaussians.cpp b/src/algorithms/LBMixtureOfGaussians.cpp
index d949adb..82d9f1e 100644
--- a/src/algorithms/LBMixtureOfGaussians.cpp
+++ b/src/algorithms/LBMixtureOfGaussians.cpp
@@ -23,7 +23,7 @@ void LBMixtureOfGaussians::process(const cv::Mat &img_input, cv::Mat &img_output
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  IplImage* frame = cvCloneImage(&(IplImage)_frame);
+  IplImage* frame = cvCloneImage(&_frame);
 
   if (firstTime) {
     int w = img_input.size().width;
diff --git a/src/algorithms/LBSimpleGaussian.cpp b/src/algorithms/LBSimpleGaussian.cpp
index 6764119..5df2c81 100644
--- a/src/algorithms/LBSimpleGaussian.cpp
+++ b/src/algorithms/LBSimpleGaussian.cpp
@@ -22,7 +22,7 @@ void LBSimpleGaussian::process(const cv::Mat &img_input, cv::Mat &img_output, cv
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  IplImage* frame = cvCloneImage(&(IplImage)_frame);
+  IplImage* frame = cvCloneImage(&_frame);
 
   if (firstTime) {
     int w = img_input.size().width;
diff --git a/src/algorithms/MultiCue.cpp b/src/algorithms/MultiCue.cpp
index 8f7e0ac..54cedb7 100644
--- a/src/algorithms/MultiCue.cpp
+++ b/src/algorithms/MultiCue.cpp
@@ -75,7 +75,7 @@ void MultiCue::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &i
 
   // Step 1: Background Modeling
   IplImage _frame = cvIplImage(img_input);
-  IplImage* frame = cvCloneImage(&(IplImage)_frame);
+  IplImage* frame = cvCloneImage(&_frame);
 
   int width = img_input.size().width;
   int height = img_input.size().height;
@@ -540,7 +540,7 @@ void MultiCue::GaussianFiltering(IplImage* frame, uchar*** aFilteredFrame) {
 
     //Store results into aFilteredFrame[][][]
     IplImage _img = cvIplImage(temp_img);
-    IplImage* img = cvCloneImage(&(IplImage)_img);
+    IplImage* img = cvCloneImage(&_img);
 
     //int iWidthStep = img->widthStep;
 
diff --git a/src/algorithms/MultiLayer.cpp b/src/algorithms/MultiLayer.cpp
index de972f1..397b851 100644
--- a/src/algorithms/MultiLayer.cpp
+++ b/src/algorithms/MultiLayer.cpp
@@ -59,7 +59,7 @@ void MultiLayer::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat
       std::cout << algorithmName + " in DETECT mode" << std::endl;
     
     IplImage _frame = cvIplImage(img_input);
-    org_img = cvCloneImage(&(IplImage)_frame);
+    org_img = cvCloneImage(&_frame);
 
     fg_img = cvCreateImage(img_size, org_img->depth, org_img->nChannels);
     bg_img = cvCreateImage(img_size, org_img->depth, org_img->nChannels);
@@ -182,7 +182,7 @@ void MultiLayer::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat
   }
 
   IplImage _frame = cvIplImage(img_input);
-  IplImage* img = cvCloneImage(&(IplImage)_frame);
+  IplImage* img = cvCloneImage(&_frame);
 
   BGS->SetRGBInputImage(img);
   BGS->Process();
diff --git a/src/algorithms/T2FGMM_UM.cpp b/src/algorithms/T2FGMM_UM.cpp
index a3bff75..c04282f 100644
--- a/src/algorithms/T2FGMM_UM.cpp
+++ b/src/algorithms/T2FGMM_UM.cpp
@@ -22,7 +22,7 @@ void T2FGMM_UM::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame_data = cvCloneImage(&(IplImage)_frame);
+  frame_data = cvCloneImage(&_frame);
 
   if (firstTime) {
     int width = img_input.size().width;
diff --git a/src/algorithms/T2FGMM_UV.cpp b/src/algorithms/T2FGMM_UV.cpp
index c366f42..c27bacc 100644
--- a/src/algorithms/T2FGMM_UV.cpp
+++ b/src/algorithms/T2FGMM_UV.cpp
@@ -22,7 +22,7 @@ void T2FGMM_UV::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame_data = cvCloneImage(&(IplImage)_frame);
+  frame_data = cvCloneImage(&_frame);
 
   if (firstTime) {
     int width = img_input.size().width;
diff --git a/src/algorithms/T2FMRF_UM.cpp b/src/algorithms/T2FMRF_UM.cpp
index 207ceab..062e312 100644
--- a/src/algorithms/T2FMRF_UM.cpp
+++ b/src/algorithms/T2FMRF_UM.cpp
@@ -22,7 +22,7 @@ void T2FMRF_UM::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame_data = cvCloneImage(&(IplImage)_frame);
+  frame_data = cvCloneImage(&_frame);
 
   if (firstTime) {
     int width = img_input.size().width;
diff --git a/src/algorithms/T2FMRF_UV.cpp b/src/algorithms/T2FMRF_UV.cpp
index ddfb9d7..c5f90f8 100644
--- a/src/algorithms/T2FMRF_UV.cpp
+++ b/src/algorithms/T2FMRF_UV.cpp
@@ -22,7 +22,7 @@ void T2FMRF_UV::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame_data = cvCloneImage(&(IplImage)_frame);
+  frame_data = cvCloneImage(&_frame);
 
   if (firstTime) {
     int width = img_input.size().width;
diff --git a/src/algorithms/VuMeter.cpp b/src/algorithms/VuMeter.cpp
index bd84edf..b0d4899 100644
--- a/src/algorithms/VuMeter.cpp
+++ b/src/algorithms/VuMeter.cpp
@@ -25,7 +25,7 @@ void VuMeter::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &im
   init(img_input, img_output, img_bgmodel);
 
   IplImage _frame = cvIplImage(img_input);
-  frame = cvCloneImage(&(IplImage)_frame);
+  frame = cvCloneImage(&_frame);
 
   if (firstTime) {
     int w = img_input.size().width;
-- 
GitLab