Scientist Anonymous

nobody knows who makes our world better

Rawpy cheat sheet

import library

import rawpy

load raw file

raw = rawpy.imread("sample.raw")

check image format

print(raw.sizes)

check white balance

print(np.array(raw.camera_whitebalance))

check color matrix

print(raw.color_matrix)

raw data, width, height

raw.sizes.raw_height``raw.sizes.raw_width raw.raw_image

all post process

img_result = raw.postprocess()

numpy array conversion

raw_array = np.array(raw.raw_image).reshape((h, w)).astype('float')

save raw image data

import imageio
outimg = img_gamma.copy().reshape((h // 2, w //2, 3))
outimg[outimg < 0] = 0
outimg = outimg * 255
imageio.imwrite("sample.png", outimg.astype('uint8'))

--

reference