mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-06 13:15:48 +03:00
Define box filter equal 1.0 on (-0.5, 0.5] range instead of [-0.5, 0.5)
This commit is contained in:
parent
8aad32a010
commit
5b53b0489b
|
@ -212,6 +212,11 @@ class TestImagingCoreResampleAccuracy(PillowTestCase):
|
||||||
for channel in case.split():
|
for channel in case.split():
|
||||||
self.check_case(channel, self.make_sample(data, (12, 12)))
|
self.check_case(channel, self.make_sample(data, (12, 12)))
|
||||||
|
|
||||||
|
def test_box_filter_correct_range(self):
|
||||||
|
im = Image.new("RGB", (8, 8), "#1688ff").resize((100, 100), Image.BOX)
|
||||||
|
ref = Image.new("RGB", (100, 100), "#1688ff")
|
||||||
|
self.assert_image_equal(im, ref)
|
||||||
|
|
||||||
|
|
||||||
class CoreResampleConsistencyTest(PillowTestCase):
|
class CoreResampleConsistencyTest(PillowTestCase):
|
||||||
def make_case(self, mode, fill):
|
def make_case(self, mode, fill):
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct filter {
|
||||||
|
|
||||||
static inline double box_filter(double x)
|
static inline double box_filter(double x)
|
||||||
{
|
{
|
||||||
if (x >= -0.5 && x < 0.5)
|
if (x > -0.5 && x <= 0.5)
|
||||||
return 1.0;
|
return 1.0;
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user