Skip to content

A python package to process raw and dng file, supporting demosaicing with gamma correction.

Notifications You must be signed in to change notification settings

DIYer22/process_raw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

process_raw: A python package to process raw and dng file

Features

  • Reading .dng file to np.array
  • Saving raw image as .dng file
  • Demosaicing (by rawpy)
  • Demosaicing with gamma correction (for raw image > 8bit)

Usage

Install

pip install process_raw 

Python example:

import cv2
from process_raw import DngFile

# Download raw.dng for test:
# wget https://github.com/yl-data/yl-data.github.io/raw/master/2201.process_raw/raw-12bit-GBRG.dng
dng_path = "./raw-12bit-GBRG.dng"

dng = DngFile.read(dng_path)
rgb1 = dng.postprocess()  # demosaicing by rawpy
cv2.imwrite("rgb1.jpg", rgb1[:, :, ::-1])
rgb2 = dng.demosaicing(poww=0.3)  # demosaicing with gamma correction
cv2.imwrite("rgb2.jpg", rgb2[:, :, ::-1])
DngFile.save(dng_path + "-save.dng", dng.raw, bit=dng.bit, pattern=dng.pattern)

Run demo:

python -m process_raw.process_raw

For document, please see example code of DngFile.test() at process_raw/process_raw.py

Credits

Source referenced from:

About

A python package to process raw and dng file, supporting demosaicing with gamma correction.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages