Skip to content

Instantly share code, notes, and snippets.

View jimmy15923's full-sized avatar

Cheng-Kun Yang jimmy15923

View GitHub Profile
@vashineyu
vashineyu / bin2img.py
Last active October 4, 2018 06:51
special image reader, one-time usage
def bin2img_mix(file_path, channel_first = False):
w, h = 70, 70
with open(file_path, 'rb') as f:
affine_info = np.fromfile(f, dtype='float64', count=6)
img1 = np.fromfile(f, dtype='single',count=245000)
img2 = np.fromfile(f, dtype='single',count=245000)
img2[img2 < -900] = -900
if channel_first:
return img1.reshape(-1, w, h), img2.reshape(-1,w,h), affine_info