finish sim

This commit is contained in:
SikongJueluo
2024-05-16 21:39:15 +08:00
parent 5eebe6e922
commit d345fed4e7
10 changed files with 62 additions and 527 deletions

BIN
sim/transform/im.tif Normal file

Binary file not shown.

23
sim/transform/raw_cut.py Normal file
View File

@@ -0,0 +1,23 @@
import imageio
import numpy as np
cut_width = 700
cut_height = 500
if __name__ == '__main__':
# txt = open('./test.dat', 'w')
binfile = open('./test.bin', "wb")
image = imageio.imread_v2('./im.tif')
print(image.shape)
cut = image[0:cut_height, 0:cut_width]
print(cut.shape)
cut = np.array(cut, dtype=np.int16)
for data in list(cut.flatten()):
# txt.write('%02x\n%02x\n' % (data & 0x00ff, (data & 0xff00) >> 4))
binfile.write(data)
# txt.close()
binfile.close()
# imageio.imsave('./test.tif', cut)

View File

@@ -0,0 +1,10 @@
import imageio
import numpy as np
im_width = 512
im_height = 256
if __name__ == '__main__':
raw = np.fromfile('./out.bin', dtype=np.int16)
image = raw.reshape((im_height, im_width))
imageio.imsave("./out.png", image)