c4dynamics.datasets.image

Contents

c4dynamics.datasets.image#

c4dynamics.datasets.image(image_name: str) str[source]#

Fetches the path of an image from the local cache.

image downloads and manages image files from c4dynamics datasets.

Image Name

Description

planes

A 1280x720 snapshot of aerobatic airplanes (planes.png, 300KB)

triangle

A 800x600 image of a triangle (triangle.png, 20KB)

The images can be found at C4dynamics/C4dynamics

Parameters:

image_name (str) – The name of the image to download

Returns:

out (str) – A path to the image file in the local cache

Examples

Import required packages:

>>> import c4dynamics as c4d
>>> import matplotlib.image as mpimg
>>> from matplotlib import pyplot as plt

planes

>>> impath = c4d.datasets.image('planes')
Fetched successfully
>>> img = mpimg.imread(impath) # read image
>>> plt.imshow(img) 
>>> plt.axis('off') 
../../../_images/planes.png

triangle

>>> impath = c4d.datasets.image('triangle')
Fetched successfully
>>> img = mpimg.imread(impath) # read image
>>> plt.imshow(img)   
>>> plt.axis('off')   
../../../_images/triangle.png