Skip to content

Commit 3544a75

Browse files
authored
Merge pull request #4060 from cabranca:fix-use-of-uninitialized-buffer-stride-variable
Move GpuMat initialization to a more suitable scope.
2 parents abaddbc + 4d16e55 commit 3544a75

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/cudaoptflow/src/nvidiaOpticalFlow.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,9 +1020,6 @@ void NvidiaOpticalFlowImpl_2::calc(InputArray _frame0, InputArray _frame1, Input
10201020
GpuMat flowXYGpuMat(Size((m_width + m_hwGridSize - 1) / m_hwGridSize,
10211021
(m_height + m_hwGridSize - 1) / m_hwGridSize), CV_16SC2,
10221022
(void*)m_flowXYcuDevPtr, m_outputBufferStrideInfo.strideInfo[0].strideXInBytes);
1023-
GpuMat flowXYGpuMatUpScaled(Size((m_width + m_gridSize - 1) / m_gridSize,
1024-
(m_height + m_gridSize - 1) / m_gridSize), CV_16SC2,
1025-
(void*)m_flowXYUpScaledcuDevPtr, m_outputUpScaledBufferStrideInfo.strideInfo[0].strideXInBytes);
10261023

10271024
//check whether frame0 is Mat or GpuMat
10281025
if (_frame0.isMat())
@@ -1105,6 +1102,9 @@ void NvidiaOpticalFlowImpl_2::calc(InputArray _frame0, InputArray _frame1, Input
11051102

11061103
if (m_scaleFactor > 1)
11071104
{
1105+
GpuMat flowXYGpuMatUpScaled(Size((m_width + m_gridSize - 1) / m_gridSize,
1106+
(m_height + m_gridSize - 1) / m_gridSize), CV_16SC2,
1107+
(void*)m_flowXYUpScaledcuDevPtr, m_outputUpScaledBufferStrideInfo.strideInfo[0].strideXInBytes);
11081108
uint32_t nSrcWidth = flowXYGpuMat.size().width;
11091109
uint32_t nSrcHeight = flowXYGpuMat.size().height;
11101110
uint32_t nSrcPitch = m_outputBufferStrideInfo.strideInfo[0].strideXInBytes;

0 commit comments

Comments
 (0)