Minor refactoring
authorAlexey Spizhevoy <no@email>
Thu, 16 Feb 2012 12:00:17 +0000 (12:00 +0000)
committerAlexey Spizhevoy <no@email>
Thu, 16 Feb 2012 12:00:17 +0000 (12:00 +0000)
modules/gpu/include/opencv2/gpu/gpu.hpp
modules/gpu/src/optical_flow_farneback.cpp

index 20ce902..ebfb5bf 100644 (file)
@@ -1850,14 +1850,14 @@ public:
     {\r
         frames_[0].release();\r
         frames_[1].release();\r
-        I_[0].release();\r
-        I_[1].release();\r
+        pyrLevel_[0].release();\r
+        pyrLevel_[1].release();\r
         M_.release();\r
         bufM_.release();\r
-        R_[0].release();\r
-        R_[1].release();\r
-        tmp_[0].release();\r
-        tmp_[1].release();\r
+        polyCoefs_[0].release();\r
+        polyCoefs_[1].release();\r
+        blurredFrame_[0].release();\r
+        blurredFrame_[1].release();\r
         pyramid0_.clear();\r
         pyramid1_.clear();\r
     }\r
@@ -1878,7 +1878,7 @@ private:
             GpuMat& M, GpuMat &bufM, int blockSize, bool updateMatrices, Stream streams[]);\r
 \r
     GpuMat frames_[2];\r
-    GpuMat I_[2], M_, bufM_, R_[2], tmp_[2];\r
+    GpuMat pyrLevel_[2], M_, bufM_, polyCoefs_[2], blurredFrame_[2];\r
     std::vector<GpuMat> pyramid0_, pyramid1_;\r
 };\r
 \r
index 6d61e04..9e66222 100644 (file)
@@ -339,15 +339,15 @@ void cv::gpu::FarnebackOpticalFlow::operator ()(
         }
         else
         {
-            GpuMat tmp[2] =
+            GpuMat blurredFrame[2] =
             {
-                allocMatFromBuf(size.height, size.width, CV_32F, tmp_[0]),
-                allocMatFromBuf(size.height, size.width, CV_32F, tmp_[1])
+                allocMatFromBuf(size.height, size.width, CV_32F, blurredFrame_[0]),
+                allocMatFromBuf(size.height, size.width, CV_32F, blurredFrame_[1])
             };
-            GpuMat I[2] =
+            GpuMat pyrLevel[2] =
             {
-                allocMatFromBuf(height, width, CV_32F, I_[0]),
-                allocMatFromBuf(height, width, CV_32F, I_[1])
+                allocMatFromBuf(height, width, CV_32F, pyrLevel_[0]),
+                allocMatFromBuf(height, width, CV_32F, pyrLevel_[1])
             };
 
             Mat g = getGaussianKernel(smoothSize, sigma, CV_32F);
@@ -356,16 +356,16 @@ void cv::gpu::FarnebackOpticalFlow::operator ()(
             for (int i = 0; i < 2; i++)
             {
                 device::optflow_farneback::gaussianBlurGpu(
-                        frames_[i], smoothSize/2, tmp[i], BORDER_REFLECT101_GPU, S(streams[i]));
+                        frames_[i], smoothSize/2, blurredFrame[i], BORDER_REFLECT101_GPU, S(streams[i]));
 #if ENABLE_GPU_RESIZE
-                resize(tmp[i], I[i], Size(width, height), INTER_LINEAR, streams[i]);
+                resize(blurredFrame[i], pyrLevel[i], Size(width, height), INTER_LINEAR, streams[i]);
 #else
                 Mat tmp1, tmp2;
                 tmp[i].download(tmp1);
                 resize(tmp1, tmp2, Size(width, height), INTER_LINEAR);
                 I[i].upload(tmp2);
 #endif
-                device::optflow_farneback::polynomialExpansionGpu(I[i], polyN, R[i], S(streams[i]));
+                device::optflow_farneback::polynomialExpansionGpu(pyrLevel[i], polyN, R[i], S(streams[i]));
             }
         }