def tcoords_pixel_scaled(self): r""" Returns a :map:`PointCloud` that is modified to be suitable for directly indexing into the pixels of the texture (e.g. for manual mapping operations). The resulting tcoords behave just like image landmarks do. The operations that are performed are: - Flipping the origin from bottom-left to top-left - Scaling the tcoords by the image shape (denormalising them) - Permuting the axis so that Returns ------- tcoords_scaled : :map:`PointCloud` A copy of the tcoords that behave like :map:`Image` landmarks Examples -------- Recovering pixel values for every texture coordinate: >>> texture = texturedtrimesh.texture >>> tc_ps = texturedtrimesh.tcoords_pixel_scaled() >>> pixel_values_at_tcs = texture.sample(tc_ps) """ return tcoords_to_image_coords(self.texture.shape).apply(self.tcoords)
def test_tcoords_to_image_coords(): assert_equal(tcoords_to_image_coords(IMG_SHAPE).apply(TCOORDS), IMG_COORDS)