attempt
This commit is contained in:
parent
a8ba2d7f52
commit
222303f24b
@ -1423,7 +1423,7 @@ public:
|
|||||||
dsize.width *= cn;
|
dsize.width *= cn;
|
||||||
AutoBuffer<WT> _buffer(dsize.width*2);
|
AutoBuffer<WT> _buffer(dsize.width*2);
|
||||||
WT *buf = _buffer, *sum = buf + dsize.width;
|
WT *buf = _buffer, *sum = buf + dsize.width;
|
||||||
int k, sy, dx, cur_dy = 0;
|
int k = -1000, sy = -1000, dx = -1000, cur_dy = -1000;
|
||||||
WT scale_y = (WT)scale_y_;
|
WT scale_y = (WT)scale_y_;
|
||||||
|
|
||||||
CV_Assert( cn <= 4 );
|
CV_Assert( cn <= 4 );
|
||||||
@ -1567,7 +1567,8 @@ public:
|
|||||||
T* D = (T*)(dst.data + dst.step*cur_dy);
|
T* D = (T*)(dst.data + dst.step*cur_dy);
|
||||||
if( fabs(beta) < 1e-3 )
|
if( fabs(beta) < 1e-3 )
|
||||||
{
|
{
|
||||||
if(cur_dy >= dsize.height) return;
|
if(cur_dy >= dsize.height)
|
||||||
|
return;
|
||||||
for( dx = 0; dx < dsize.width; dx++ )
|
for( dx = 0; dx < dsize.width; dx++ )
|
||||||
{
|
{
|
||||||
D[dx] = saturate_cast<T>((sum[dx] + buf[dx]) / min(scale_y, src.rows - cur_dy * scale_y));
|
D[dx] = saturate_cast<T>((sum[dx] + buf[dx]) / min(scale_y, src.rows - cur_dy * scale_y));
|
||||||
@ -1621,12 +1622,16 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in
|
|||||||
Size ssize = src.size(), dsize = dst.size();
|
Size ssize = src.size(), dsize = dst.size();
|
||||||
AutoBuffer<int> _yofs(2 * ssize.height);
|
AutoBuffer<int> _yofs(2 * ssize.height);
|
||||||
int *yofs = _yofs, *cur_dy_ofs = _yofs + ssize.height;
|
int *yofs = _yofs, *cur_dy_ofs = _yofs + ssize.height;
|
||||||
int index = 0, cur_dy = 0, sy;
|
int index = 0, cur_dy = 0;
|
||||||
|
|
||||||
for( sy = 0; sy < ssize.height; sy++ )
|
// cur_dy_ofs - dy for the current sy
|
||||||
|
// yofs - a starting row for calculating a band according to the current sy
|
||||||
|
|
||||||
|
for (int sy = 0; sy < ssize.height; sy++)
|
||||||
{
|
{
|
||||||
bool reset = false;
|
|
||||||
cur_dy_ofs[sy] = cur_dy;
|
cur_dy_ofs[sy] = cur_dy;
|
||||||
|
yofs[sy] = index;
|
||||||
|
|
||||||
if ((cur_dy + 1) * scale_y_ <= sy + 1 || sy == ssize.height - 1 )
|
if ((cur_dy + 1) * scale_y_ <= sy + 1 || sy == ssize.height - 1 )
|
||||||
{
|
{
|
||||||
WT beta = (WT)std::max(sy + 1 - (cur_dy + 1) * scale_y_, 0.);
|
WT beta = (WT)std::max(sy + 1 - (cur_dy + 1) * scale_y_, 0.);
|
||||||
@ -1634,13 +1639,10 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in
|
|||||||
{
|
{
|
||||||
if (cur_dy >= dsize.height)
|
if (cur_dy >= dsize.height)
|
||||||
break;
|
break;
|
||||||
reset = true;
|
index = sy + 1;
|
||||||
}
|
}
|
||||||
cur_dy++;
|
cur_dy++;
|
||||||
}
|
}
|
||||||
yofs[sy] = index;
|
|
||||||
if (reset)
|
|
||||||
index = sy + 1;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1498,11 +1498,14 @@ TEST(Imgproc_resize_area, regression)
|
|||||||
|
|
||||||
ASSERT_EQ(actual.type(), expected.type());
|
ASSERT_EQ(actual.type(), expected.type());
|
||||||
ASSERT_EQ(actual.size(), expected.size());
|
ASSERT_EQ(actual.size(), expected.size());
|
||||||
|
|
||||||
Mat diff;
|
Mat diff;
|
||||||
absdiff(actual, expected, diff);
|
absdiff(actual, expected, diff);
|
||||||
Mat one_channel_diff = diff.reshape(1);
|
std::cout << "Abs diff:" << std::endl << diff << std::endl;
|
||||||
|
|
||||||
int elem_diff = 1;
|
Mat one_channel_diff = diff; //.reshape(1);
|
||||||
|
|
||||||
|
float elem_diff = 1.0f;
|
||||||
Size dsize = actual.size();
|
Size dsize = actual.size();
|
||||||
bool next = true;
|
bool next = true;
|
||||||
for (int dy = 0; dy < dsize.height && next; ++dy)
|
for (int dy = 0; dy < dsize.height && next; ++dy)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user