イメージファイルの読み込み

イメージファイルの読み込み#

イメージファイル(JPEG,TIFF,PNGなど)の読み込みとプロットを行います.

from __future__ import annotations

from pyvista import examples

PyVistaでは,イメージを空間的に参照されるデータオブジェクト(この例)に読み込むことが完全にサポートされており,イメージをデータセット( テクスチャを適用する を参照)にテクスチャマッピングすることもサポートされています.

Download a JPEG image of a bird and load it to pyvista.ImageData. This could similarly be implemented with any image file by using the pyvista.read() function and passing the path to the image file.

image = examples.download_bird()
# 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')
read image
# Mapped image colors
image.plot(cpos='xy')
read image

Tags: load

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

Sphinx-Galleryによるギャラリー