Image Restoration Tool

texture

This tool removes lighting artefacts such as shown here.

Requires

  • Windows (tested on Vista)
  • For handling JPEGs, PNGs, etc., you also need ImageMagick (download ImageMagick-6.6.1-3-Q16-windows-dll.exe) This file is about 30 MB :( This dependency will hopefully be removed in the future. Without ImageMagick, the tool still supports BMPs.

Download

WARNING: The tool is very crude, and will only report some errors—in other cases it will just crash. Use only for experimentation; a production version will be posted soon.

image_restore_v1_1.zip (504 KB)

(Includes examples)

Usage

At his stage, only a command line interface is supported. The general syntax is:

image_restore {function} {input file} {output file} {options}*

There are four basic functions

mean {inner_window_width} [outer_window_width]

Restores the mean of the image.

std {inner_window_width} [outer_window_width]

Restores the mean and standard deviation of the image.

minmax {inner_window_width} [outer_window_width]

Restores the minimum and maximum values of the image.

range {inner_window_width} [outer_window_width]

Restores the mean and range (difference between maximum and minimum values) of the image.

They all try to restore some image statistics in the smaller window to that of the larger window. If the outer window width is not supplied, the entire image is used.

These functions all process channels independently. Alternative functions provides means to process based on combined channel values instead, for example, the lightness or value of an image.

The syntax for these functions are as follows:

mean_fn {inner_window_width} [outer_window_width] {method}
std_fn {inner_window_width} [outer_window_width] {method}
minmax_fn {inner_window_width} [outer_window_width] {method}|
range_fn {inner_window_width} [outer_window_width] {method}

The {method} parameter is the method used to combine the channels. The following methods are provided:

  • value normalised Euclidean length of colour vector
  • lightness average of the three channels
  • max maximum component
  • min minimum component
  • mid (average of min and max)
  • med median component
  • red red component
  • green green component
  • blue blue component
  • y709 0.2125*R + 0.7154*G + 0.0721*B (Luminance for contemporary CRT phosphors as standardized by Recccomondation 709—see this Color FAQ for more information).

Examples

image_restore mean input/hair.jpg output/hair_mean_.png 41
image_restore mean input/wood.jpg output/wood_mean_.png 91
image_restore std input/wood.jpg output/wood_std_.png 91
image_restore mean input/paper.jpg output/paper_mean_.png 31
image_restore mean input/grass.jpg output/grass_mean_.png 11
image_restore mean input/color.jpg output/color_mean_1.png 21 41
image_restore mean input/color.jpg output/color_mean_2.png 101
image_restore mean input/paint.jpg output/paint_mean_.png 71
image_restore mean input/metal.jpg output/metal_mean_.png 31
image_restore mean input/metal2.jpg output/metal2_mean_.png 31
image_restore mean input/scene.jpg output/scene_mean.png 201
image_restore mean_fn input/scene.jpg output/scene_mean_lightness.png 21 lightness
image_restore minmax input/pebbles.jpg output/pebbles_minmax.png 41
image_restore std input/machinery.jpg output/machinery_minmax.png 75
image_restore std input/hair.jpg output/hair_std_.png 31
image_restore mean_fn input/color.jpg output/color_mean_lightness_.png 21 lightness
image_restore mean_fn input/color.jpg output/color_mean_value_.png 21 value
image_restore mean hair.jpg hair_mean_.png 41

image_restore std wood.jpg wood_std_.png 91

image_restore mean color.jpg color_mean_1.png 21 41

image_restore range scene.jpg scene_range.png 201

image_restore mean_fn scene.jpg scene_mean_lightness.png 21 lightness

image_restore minmax pebbles.jpg pebbles_minmax.png 41

image_restore std_fn machinery.jpg machinery_std.png 75 100 max

image_restore std hair.jpg hair_std_.png 31

image_restore mean_fn color.jpg color_mean_l_.png 21 lightness

image_restore mean_fn color.jpg color_mean_v_.png 21 value

Usage Guidelines

  • The four basic algorithms work best on images that are essentially one colour (or at least, where you want the output to be roughly the same colour). Thus it will process grass well, but not a grass with red flowers.
  • First see what results you get by using {mean}. If too much detail is lost in the highlights or lowlights, try using {std}. The other too functions are more extreme; {range} centres about the mean, while {minmax} does not.
  • The smaller the inner radius, the more the image will be modified.
  • The bigger the outer radius is, the more homogeneously the image will be processed. Using a relatively small outer radius can improve results on images that are multi-coloured.
  • All algorithms deal better with smooth changes—for example, soft shadows can be removed, but not hard shadows.
  • Multicolour images can sometimes be successfully processed using the _fn versions of the basic algorithms. Of all methods, {value} and {lightness} are the most useful—the others are more for interests sake.