本文整理匯總了Python中texture.Texture.resize方法的典型用法代碼示例。如果您正苦於以下問題:Python Texture.resize方法的具體用法?Python Texture.resize怎麽用?Python Texture.resize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類texture.Texture
的用法示例。
在下文中一共展示了Texture.resize方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_resize
# 需要導入模塊: from texture import Texture [as 別名]
# 或者: from texture.Texture import resize [as 別名]
def test_resize(self):
data = np.zeros((10, 10), dtype=np.uint8)
T = Texture(data=data)
T.resize((5, 5))
assert T.shape == (5, 5)
assert T._data.shape == (5, 5)
assert T._need_resize == True
assert T._need_update == False
assert len(T._pending_data) == 0
示例2: test_invalid_views
# 需要導入模塊: from texture import Texture [as 別名]
# 或者: from texture.Texture import resize [as 別名]
def test_invalid_views(self):
data = np.zeros((10, 10), dtype=np.uint8)
T = Texture(data=data)
Z = T[5:, 5:]
T.resize((5, 5))
assert Z._valid == False
示例3: test_resize_unresizeable
# 需要導入模塊: from texture import Texture [as 別名]
# 或者: from texture.Texture import resize [as 別名]
def test_resize_unresizeable(self):
data = np.zeros((10, 10), dtype=np.uint8)
T = Texture(data=data, resizeable=False)
with self.assertRaises(RuntimeError):
T.resize((5, 5))
示例4: test_resize_bad_shape
# 需要導入模塊: from texture import Texture [as 別名]
# 或者: from texture.Texture import resize [as 別名]
def test_resize_bad_shape(self):
data = np.zeros((10, 10), dtype=np.uint8)
T = Texture(data=data)
with self.assertRaises(ValueError):
T.resize((5, 5, 5))