本文整理汇总了Python中mapproxy.image.transform.ImageTransformer类的典型用法代码示例。如果您正苦于以下问题:Python ImageTransformer类的具体用法?Python ImageTransformer怎么用?Python ImageTransformer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImageTransformer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_transform
def test_transform(self, mesh_div=4):
transformer = ImageTransformer(self.src_srs, self.dst_srs, mesh_div=mesh_div)
result = transformer.transform(self.src_img, self.src_bbox, self.dst_size, self.dst_bbox,
image_opts=ImageOptions(resampling='nearest'))
assert isinstance(result, ImageSource)
assert result.as_image() != self.src_img
assert result.size == (100, 150)
示例2: _test_compare_mesh_div
def _test_compare_mesh_div(self):
"""
Create transformations with different div values.
"""
for div in [1, 2, 4, 6, 8, 12, 16]:
transformer = ImageTransformer(self.src_srs, self.dst_srs, mesh_div=div)
result = transformer.transform(self.src_img, self.src_bbox,
self.dst_size, self.dst_bbox)
result.as_image().save('/tmp/transform-%d.png' % (div,))
示例3: test_simple_resize_nearest
def test_simple_resize_nearest(self):
bbox = (-10, -5, 30, 35)
transformer = ImageTransformer(SRS(4326), SRS(4326))
result = transformer.transform(self.img, bbox, (200, 200), bbox,
image_opts=ImageOptions(resampling='nearest'))
img = result.as_image()
eq_(img.size, (200, 200))
eq_(len(img.getcolors()), 2)
示例4: test_simple_resize_bilinear
def test_simple_resize_bilinear(self):
bbox = (-10, -5, 30, 35)
transformer = ImageTransformer(SRS(4326), SRS(4326))
result = transformer.transform(self.img, bbox, (200, 200), bbox,
image_opts=ImageOptions(resampling='bilinear'))
img = result.as_image()
eq_(img.size, (200, 200))
# some shades of grey with bilinear
assert len(img.getcolors()) >= 4
示例5: _test_compare_max_px_err
def _test_compare_max_px_err(self):
"""
Create transformations with different div values.
"""
for err in [0.2, 0.5, 1, 2, 4, 6, 8, 12, 16]:
transformer = ImageTransformer(self.src_srs, self.dst_srs, max_px_err=err)
result = transformer.transform(self.src_img, self.src_bbox,
self.dst_size, self.dst_bbox,
image_opts=ImageOptions(resampling='nearest'))
result.as_image().save('/tmp/transform-%03d.png' % (err*10,))
示例6: transform
def transform(self, req_bbox, req_srs, out_size, image_opts):
"""
Return the the tiles as one merged and transformed image.
:param req_bbox: the bbox of the output image
:param req_srs: the srs of the req_bbox
:param out_size: the size in pixel of the output image
:rtype: `ImageSource`
"""
transformer = ImageTransformer(self.src_srs, req_srs)
src_img = self.image(image_opts)
return transformer.transform(src_img, self.src_bbox, out_size, req_bbox,
image_opts)
示例7: test_perfect_match
def test_perfect_match(self):
bbox = (-10, -5, 30, 35)
transformer = ImageTransformer(SRS(4326), SRS(4326))
result = transformer.transform(self.img, bbox, (100, 100), bbox, image_opts=None)
assert self.img == result