mirror of
https://github.com/opencv/opencv.git
synced 2024-11-30 06:10:02 +08:00
fixed memory leak caused by illegal memory access
(cherry picked from commit 4722b2d0e5
)
This commit is contained in:
parent
c16f465ff5
commit
d28e6c9b36
@ -644,8 +644,7 @@ private:
|
||||
};
|
||||
|
||||
CV_Remap_Test::CV_Remap_Test() :
|
||||
CV_ImageWarpBaseTest(), mapx(), mapy(),
|
||||
borderType(-1), borderValue()
|
||||
CV_ImageWarpBaseTest(), borderType(-1)
|
||||
{
|
||||
funcs[0] = &CV_Remap_Test::remap_nearest;
|
||||
funcs[1] = &CV_Remap_Test::remap_generic;
|
||||
@ -666,7 +665,7 @@ void CV_Remap_Test::generate_test_data()
|
||||
// generating the mapx, mapy matrices
|
||||
static const int mapx_types[] = { CV_16SC2, CV_32FC1, CV_32FC2 };
|
||||
mapx.create(dst.size(), mapx_types[rng.uniform(0, sizeof(mapx_types) / sizeof(int))]);
|
||||
mapy = Mat();
|
||||
mapy.release();
|
||||
|
||||
const int n = std::min(std::min(src.cols, src.rows) / 10 + 1, 2);
|
||||
float _n = 0; //static_cast<float>(-n);
|
||||
@ -693,7 +692,7 @@ void CV_Remap_Test::generate_test_data()
|
||||
{
|
||||
MatIterator_<ushort> begin_y = mapy.begin<ushort>(), end_y = mapy.end<ushort>();
|
||||
for ( ; begin_y != end_y; ++begin_y)
|
||||
begin_y[0] = static_cast<short>(rng.uniform(0, 1024));
|
||||
*begin_y = static_cast<ushort>(rng.uniform(0, 1024));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -701,7 +700,7 @@ void CV_Remap_Test::generate_test_data()
|
||||
{
|
||||
MatIterator_<short> begin_y = mapy.begin<short>(), end_y = mapy.end<short>();
|
||||
for ( ; begin_y != end_y; ++begin_y)
|
||||
begin_y[0] = static_cast<short>(rng.uniform(0, 1024));
|
||||
*begin_y = static_cast<short>(rng.uniform(0, 1024));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -718,8 +717,8 @@ void CV_Remap_Test::generate_test_data()
|
||||
MatIterator_<float> begin_y = mapy.begin<float>();
|
||||
for ( ; begin_x != end_x; ++begin_x, ++begin_y)
|
||||
{
|
||||
begin_x[0] = rng.uniform(_n, fscols);
|
||||
begin_y[0] = rng.uniform(_n, fsrows);
|
||||
*begin_x = rng.uniform(_n, fscols);
|
||||
*begin_y = rng.uniform(_n, fsrows);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -731,8 +730,8 @@ void CV_Remap_Test::generate_test_data()
|
||||
fsrows = static_cast<float>(std::max(src.rows - 1 + n, 0));
|
||||
for ( ; begin_x != end_x; ++begin_x)
|
||||
{
|
||||
begin_x[0] = rng.uniform(_n, fscols);
|
||||
begin_x[1] = rng.uniform(_n, fsrows);
|
||||
(*begin_x)[0] = rng.uniform(_n, fscols);
|
||||
(*begin_x)[1] = rng.uniform(_n, fsrows);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -777,23 +776,6 @@ void CV_Remap_Test::prepare_test_data_for_reference_func()
|
||||
{
|
||||
CV_ImageWarpBaseTest::prepare_test_data_for_reference_func();
|
||||
convert_maps();
|
||||
/*
|
||||
const int ksize = 3;
|
||||
Mat kernel = getStructuringElement(CV_MOP_ERODE, Size(ksize, ksize));
|
||||
Mat mask(src.size(), CV_8UC1, Scalar::all(255)), dst_mask;
|
||||
cv::erode(src, erode_src, kernel);
|
||||
cv::erode(mask, dst_mask, kernel, Point(-1, -1), 1, BORDER_CONSTANT, Scalar::all(0));
|
||||
bitwise_not(dst_mask, mask);
|
||||
src.copyTo(erode_src, mask);
|
||||
dst_mask.release();
|
||||
|
||||
mask = Scalar::all(0);
|
||||
kernel = getStructuringElement(CV_MOP_DILATE, kernel.size());
|
||||
cv::dilate(src, dilate_src, kernel);
|
||||
cv::dilate(mask, dst_mask, kernel, Point(-1, -1), 1, BORDER_CONSTANT, Scalar::all(255));
|
||||
src.copyTo(dilate_src, dst_mask);
|
||||
dst_mask.release();
|
||||
*/
|
||||
}
|
||||
|
||||
void CV_Remap_Test::run_reference_func()
|
||||
|
Loading…
Reference in New Issue
Block a user