Giter Club home page Giter Club logo

process_raw's Introduction

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 

Run demo:

python -m process_raw.process_raw

Then, the browser will automatically open a visual web page, like demo.html

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

Python example:

import cv2
import numpy as np
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)
raw = dng.raw  # np.uint16
raw_8bit = np.uint8(raw >> (dng.bit-8))
cv2.imwrite("raw_8bit.png", raw_8bit)

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)

Credits

Source referenced from:

process_raw's People

Contributors

diyer22 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.