CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
create_dat.py39 linesDownload Raw Back to data
1#!/usr/bin/env python
2
3"""Helper script for creating image .dat files by numpy.save
4
5Usage:
6
7    python create_dat.py <name of image file> <name of dat file>
8
9Example (to create aero.dat):
10
11    python create_dat.py aero.png aero.dat
12
13Requires Scipy and PIL.
14"""
15
16
17import sys
18
19import numpy as np
20
21
22def main():
23    from scipy.misc import imread
24
25    if len(sys.argv) != 3:
26        print(__doc__)
27        exit()
28
29    image_fname = sys.argv[1]
30    dat_fname = sys.argv[2]
31
32    data = imread(image_fname)
33
34    np.savez_compressed(dat_fname, data=data)
35
36
37if __name__ == "__main__":
38    main()
39 
Aluode/PerceptionLabPortable · CoolFace