-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,41 @@ | ||
# process_raw: A python package to process raw and dng file | ||
# `process_raw`: A python package to process raw and dng file | ||
|
||
## Feature | ||
- [x] Reading dng file | ||
- [x] Saving dng file | ||
- [x] Demosaicing | ||
- [x] Demosaicing with pow (for raw image > 8bit) | ||
## Features | ||
- [x] Reading `.dng` file to `np.array` | ||
- [x] Saving raw image as `.dng` file | ||
- [x] Demosaicing (by rawpy) | ||
- [x] Demosaicing with [gamma correction](https://en.wikipedia.org/wiki/Gamma_correction) (for raw image > 8bit) | ||
|
||
## Usage | ||
**Install** | ||
```bash | ||
# Install | ||
pip install process_raw | ||
``` | ||
**Python example:** | ||
```Python | ||
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" | ||
|
||
# Run example | ||
python3 -m process_raw.process_raw | ||
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:** | ||
```bash | ||
python -m process_raw.process_raw | ||
``` | ||
For document, please see example code of `DngFileformat.test()` at [`process_raw/process_raw.py`](process_raw/process_raw.py#L154) | ||
For document, please see example code of `DngFile.test()` at [`process_raw/process_raw.py`](process_raw/process_raw.py#L154) | ||
|
||
## Credits | ||
Source referenced from: | ||
- [PiDNG](https://github.com/schoolpost/PiDNG): for save dng file | ||
- [rawpy](https://github.com/letmaik/rawpy): for read dng file | ||
- [rawpy](https://github.com/letmaik/rawpy): for read `.dng` file | ||
- [PiDNG](https://github.com/schoolpost/PiDNG): for save raw as `.dng` file | ||
- [colour_demosaicing](https://github.com/colour-science/colour-demosaicing): Provide demosaicing algorithms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters