File size: 385 Bytes
b412062
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import png
import numpy as np

# Generate a 1024x1024 random noise image to simulate an X-ray
width = 512
height = 512
img = np.random.randint(0, 65535, (height, width)).astype(np.uint16)

with open('data/test_xray.png', 'wb') as f:
    writer = png.Writer(width=width, height=height, greyscale=True, bitdepth=16)
    writer.write(f, img.tolist())

print("Created data/test_xray.png")