kwimage.im_demodata

Module Contents

kwimage.im_demodata._TEST_IMAGES
kwimage.im_demodata._update_hashes()

for dev use to update hashes of the demo images

CommandLine:
xdoctest -m kwimage.im_demodata _update_hashes xdoctest -m kwimage.im_demodata _update_hashes –require-hashes
kwimage.im_demodata.grab_test_image(key='astro', space='rgb', dsize=None, interpolation='lanczos')

Ensures that the test image exists (this might use the network), reads it and returns the the image pixels.

Parameters:
  • key (str) – which test image to grab. Valid choices are: astro - an astronaught carl - Carl Sagan paraview - ParaView logo stars - picture of stars in the sky airport - SkySat image of Beijing Capital International Airport on 18 February 2018
  • space (str, default=’rgb’) – which colorspace to return in
  • dsize (Tuple[int, int], default=None) – if specified resizes image to this size
Returns:

the requested image

Return type:

ndarray

CommandLine:
xdoctest -m kwimage.im_demodata grab_test_image

Example

>>> for key in grab_test_image.keys():
...     grab_test_image(key)
>>> grab_test_image('astro', dsize=(255, 255)).shape
(255, 255, 3)
kwimage.im_demodata.grab_test_image_fpath(key='astro')

Ensures that the test image exists (this might use the network) and returns the cached filepath to the requested image.

Parameters:key (str) – which test image to grab. Valid choices are: astro - an astronaught carl - Carl Sagan paraview - ParaView logo stars - picture of stars in the sky
Returns:path to the requested image
Return type:str

Example

>>> for key in grab_test_image.keys():
...     grab_test_image_fpath(key)
kwimage.im_demodata.keys
kwimage.im_demodata.keys