注釈
Go to the end to download the full example code.
イメージファイルの読み込み#
イメージファイル(JPEG,TIFF,PNGなど)の読み込みとプロットを行います.
from __future__ import annotations
from pyvista import examples
PyVistaでは,イメージを空間的に参照されるデータオブジェクト(この例)に読み込むことが完全にサポートされており,イメージをデータセット( テクスチャを適用する を参照)にテクスチャマッピングすることもサポートされています.
子犬のJPEG画像をダウンロードし, pyvista.ImageData
にロードします.これは pyvista.read()
関数を使用し,画像ファイルへのパスを渡すことで,どんな画像ファイルにも同様に実装できます.
image = examples.download_puppy()
# or...
# image = pv.read('my_image.jpg')
When plotting images stored in pyvista.ImageData
objects, it is
important to specify using the rgb option when plotting to ensure that the
image's true colors are used and not mapped.
# True image colors
image.plot(rgb=True, cpos='xy')

# Mapped image colors
image.plot(cpos='xy')

Total running time of the script: (0 minutes 34.756 seconds)