Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RAW Image processing in Python [closed]

Are there any Pythonic solutions to reading and processing RAW images. Even if it's simply accessing a raw photo file (eg. cr2 or dng) and then outputting it as a jpeg.

Ideally a dcraw bindings for python, but anything else that can accomplish the came would be sufficient as well.

like image 891
The Unknown Avatar asked Mar 11 '10 01:03

The Unknown


People also ask

Is Python good for image processing?

Python is an excellent choice for these types of image processing tasks due to its growing popularity as a scientific programming language and the free availability of many state-of-the-art image processing tools in its ecosystem.

How do I import Rawpy?

After that, install rawpy using: git clone https://github.com/letmaik/rawpy cd rawpy pip install numpy cython pip install . The LibRaw library is installed in /usr/local/lib (if installed manually) and apparently this folder is not searched for libraries by default in some Linux distributions.


2 Answers

A while ago I wrote a libraw/dcraw wrapper called rawpy. It is quite easy to use:

import rawpy import imageio  raw = rawpy.imread('image.nef') rgb = raw.postprocess() imageio.imsave('default.tiff', rgb) 

It works natively with numpy arrays and supports a lot of options, including direct access to the unprocessed Bayer data.

like image 93
letmaik Avatar answered Sep 19 '22 21:09

letmaik


ImageMagick supports most RAW formats and provides Python bindings.

As for dcraw bindings for Python: dcraw is written in C, so you can access it through ctypes module.

like image 43
vartec Avatar answered Sep 17 '22 21:09

vartec