Skip to content
← All projects
Project

RawAnalyser

Listen to the audio story

Looking inside a raw camera image · 1:36 · AI-written script, synthetic voices

Transcript

Ava: A photo from your phone is polished. A raw image straight off a camera sensor is the unpolished data underneath. RawAnalyser is a Python tool that lets Antoine look right into it.

Andrew: What does it look for?

Ava: Three main things. Black and white clipping, meaning whether the darkest and brightest values are cut off. Gamma. And flatness, including vignette detection, which is how much the image darkens toward the corners. The vignette idea comes from Algolux.

Andrew: How do you tell it where to look?

Ava: With a small JSON file that marks the region of interest and the gray patches, those neutral squares used for measuring. You give the script a folder of raw images plus that file, and choose which analyses to run: clipping, gamma, vignette or histograms.

Andrew: Drawing coordinates by hand sounds painful.

Ava: That's what the GUI is for. It lets you select the region and gray patches on a raw or TIFF file, saves them to the JSON file, and keeps watching the folder for new images as they arrive.

Andrew: Any pixel-level tools?

Ava: Yes, a small script called RawPixel. Give it a file and coordinates, and it tells you the pixel's value and its color according to the Bayer pattern, the checkerboard of red, green and blue filters on a sensor. There's also a helper that converts twenty megapixel images to five for a particular sensor.

Andrew: Is there an example of the sensor info?

Ava: The page shows one: an OV2740 camera, ten-bit sensor values, and a B G G R Bayer pattern. The GitHub repository has all the options and usage examples.

Table of contents

here

RawAnalyser

RawAnalyser is a Python tool for analyzing raw images: black and white clipping detection, gamma calculation, and flatness with vignette detection (Algolux).

Prerequisites

You need to have Python 2.7 installed and the following libraries:

  • json
  • time
  • numpy
  • scipy
  • pyqt5
  • argparse
  • argcomplete
  • watchdog
  • logging
  • colorama
  • plotly
  • matplotlib

Usage

  1. Run the RawAnalyser script:
python RawAnalyser.py <pathfolder> <pointfile> --func <clipping,gamma,vignette,histogram,noHist,basic, default all> --bl <black level, default 1024> --vignette <pathvignette>
  1. Start the GUI:
python GUI.py
  1. Check the value of the pixel and the color with the bayer pattern:
python RawPixel.pt input<file> x y  --bitdepth <8,10,16,default 16>

Scripts Description

RawAnalyser.py

Checks black and white clipping levels in a raw image. Takes a folder path and a JSON file with the region of interest and gray patches.

points.json

The JSON file specifying the region of interest. An example of its structure is as follows:

{
    "last_y": 798,
    "last_x": 1353,
    "gray_first_y": 691,
    "gray_first_x": 606,
    "first_x": 603,
    "first_y": 315,
    "gray_last_x": 1347,
    "gray_last_y": 795
}

GUI.py

A GUI script for image selection. It allows you to select the region of interest and the gray patches in a raw or TIFF file, which are then saved in a JSON file. It also constantly checks for new files in the raw folder.

RawPixel.py

A script to inspect the value of a specific pixel and determine its color using the Bayer pattern.

20MPto5MP.py

Converts 20-megapixel images to 5-megapixel images for the OV20880 sensor.

Camera

Example of camera sensor information:

Camera: OV2740
Resolution: (1088, 1928)
ImageType: BINARY16U
Sensor value: 10 bit
Bayer pattern: 'bggr'