MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / retrieve_kodak_set

Function retrieve_kodak_set

Test/astc_test_image_dl.py:118–157  ·  view source on GitHub ↗

Download the public domain Kodak image set. To make test set mosaics easier to build we rotate images to make everything landscape.

()

Source from the content-addressed store, hash-verified

116
117
118def retrieve_kodak_set():
119 '''
120 Download the public domain Kodak image set.
121
122 To make test set mosaics easier to build we rotate images to make
123 everything landscape.
124 '''
125 test_set = 'Kodak'
126
127 # Download the original RGB images
128 for i in range(1, 25):
129 src_url = f'http://r0k.us/graphics/kodak/kodak/kodim{i:02}.png'
130
131 dst_file = f'ldr-rgb-kodak{i:02}.png'
132 dst_path = TEST_IMAGE_DIR / 'Kodak' / 'LDR-RGB' / dst_file
133 download(test_set, i, src_url, dst_path)
134
135 # Canonicalize image aspect
136 make_landscape(dst_path)
137
138 # Make some correlated alpha RGBA images
139 src_dir = TEST_IMAGE_DIR / 'Kodak' / 'LDR-RGB'
140 dst_dir = TEST_IMAGE_DIR / 'KodakSim' / 'LDR-RGBA'
141
142 for i in (22, 23):
143 src_path = src_dir / f'ldr-rgb-kodak{i:02}.png'
144 dst_path = dst_dir / f'ldr-rgba-kodak{i:02}+ca.png'
145 make_mixed_image(src_path, src_path, dst_path)
146
147 # Make some non-correlated alpha RGBA images
148 for i, j in ((22, 24), (23, 20)):
149 srca_path = src_dir / f'ldr-rgb-kodak{i:02}.png'
150 srcb_path = src_dir / f'ldr-rgb-kodak{j:02}.png'
151
152 dst_path = dst_dir / f'ldr-rgba-kodak{i:02}+{j:02}+nca.png'
153 make_mixed_image(srca_path, srcb_path, dst_path)
154
155 # Make a large montage
156 dst_path = TEST_IMAGE_DIR / 'KodakMnt' / 'LDR-RGBA' / 'ldr-rgb-montage.png'
157 make_montage(src_dir, dst_path)
158
159
160def main() -> int:

Callers 1

mainFunction · 0.85

Calls 4

downloadFunction · 0.85
make_landscapeFunction · 0.85
make_mixed_imageFunction · 0.85
make_montageFunction · 0.85

Tested by

no test coverage detected