finish domosaic2 simulate

This commit is contained in:
SikongJueluo
2024-05-14 21:00:19 +08:00
parent ee812630dd
commit 507f116560
11 changed files with 88 additions and 524348 deletions

View File

@@ -5,15 +5,19 @@ cut_width = 512
cut_height = 256
if __name__ == '__main__':
txt = open('./test.dat', 'w')
# 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))
txt.close()
# txt.write('%02x\n%02x\n' % (data & 0x00ff, (data & 0xff00) >> 4))
binfile.write(data)
# txt.close()
binfile.close()
imageio.imsave('./test.tif', cut)
# imageio.imsave('./test.tif', cut)

View File

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

File diff suppressed because it is too large Load Diff

Binary file not shown.