本文整理汇总了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)
开发者ID:atrawog,项目名称:mapproxy,代码行数:7,代码来源:test_image.py
示例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,))
开发者ID:atrawog,项目名称:mapproxy,代码行数:9,代码来源:test_image.py
示例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)
开发者ID:atrawog,项目名称:mapproxy,代码行数:9,代码来源:test_image.py
示例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
开发者ID:atrawog,项目名称:mapproxy,代码行数:10,代码来源:test_image.py
示例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,))
开发者ID:LKajan,项目名称:mapproxy,代码行数:10,代码来源:test_image.py
示例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)
开发者ID:LKajan,项目名称:mapproxy,代码行数:13,代码来源:tile.py
示例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
开发者ID:atrawog,项目名称:mapproxy,代码行数:5,代码来源:test_image.py
注:本文中的mapproxy.image.transform.ImageTransformer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论