當前位置: 首頁>>代碼示例>>Python>>正文


Python ImageTransformer.transform方法代碼示例

本文整理匯總了Python中mapproxy.image.transform.ImageTransformer.transform方法的典型用法代碼示例。如果您正苦於以下問題:Python ImageTransformer.transform方法的具體用法?Python ImageTransformer.transform怎麽用?Python ImageTransformer.transform使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mapproxy.image.transform.ImageTransformer的用法示例。


在下文中一共展示了ImageTransformer.transform方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_transform

# 需要導入模塊: from mapproxy.image.transform import ImageTransformer [as 別名]
# 或者: from mapproxy.image.transform.ImageTransformer import transform [as 別名]
 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,代碼行數:9,代碼來源:test_image.py

示例2: _test_compare_mesh_div

# 需要導入模塊: from mapproxy.image.transform import ImageTransformer [as 別名]
# 或者: from mapproxy.image.transform.ImageTransformer import transform [as 別名]
 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,代碼行數:11,代碼來源:test_image.py

示例3: test_simple_resize_nearest

# 需要導入模塊: from mapproxy.image.transform import ImageTransformer [as 別名]
# 或者: from mapproxy.image.transform.ImageTransformer import transform [as 別名]
 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,代碼行數:11,代碼來源:test_image.py

示例4: test_simple_resize_bilinear

# 需要導入模塊: from mapproxy.image.transform import ImageTransformer [as 別名]
# 或者: from mapproxy.image.transform.ImageTransformer import transform [as 別名]
 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,代碼行數:12,代碼來源:test_image.py

示例5: _test_compare_max_px_err

# 需要導入模塊: from mapproxy.image.transform import ImageTransformer [as 別名]
# 或者: from mapproxy.image.transform.ImageTransformer import transform [as 別名]
 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,代碼行數:12,代碼來源:test_image.py

示例6: transform

# 需要導入模塊: from mapproxy.image.transform import ImageTransformer [as 別名]
# 或者: from mapproxy.image.transform.ImageTransformer import transform [as 別名]
    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,代碼行數:15,代碼來源:tile.py

示例7: test_perfect_match

# 需要導入模塊: from mapproxy.image.transform import ImageTransformer [as 別名]
# 或者: from mapproxy.image.transform.ImageTransformer import transform [as 別名]
 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,代碼行數:7,代碼來源:test_image.py


注:本文中的mapproxy.image.transform.ImageTransformer.transform方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。