Manipulating Contrast Enhancement

Learn more about Contrast Enhancement in SPRING

If there is an image (IL) on the active screen, it is possible to access the option Image - Contrast... on the main menu. The following window is presented:

SPRING allows the contrast manipulation through many options on the Operation item: MinMax, Linear, Square Root, Square, Logarithm, Negative, Histogram Equalization, Slicing and Editing.

On the Operation  item you can choose the type of equation to be applied to the image, depending on the Channel active at that moment. By "default", when we open the "Contrast" window, no operation will be active. When we close it, the system asks if we want to go back to the initial situation, and, in this case, the contrast will not be reapplied when another Image is loaded.

On the Channel  item you should choose the Channel that will be on for modifying the histogram. For a single Image in gray levels, use the Mono option. For color composite, the histogram visualization will be done individually, on the channels Blue (B), Green (G) and Red (R), and, at the same time, observe the manipulation outcome. If you want to manipulate the histograms in color composite, see "Enhancing color composite". It is possible to control the histogram to be presented on the View item.

On the Execute item you have some options: Reset restores the histogram to the Linear Operation without changing the contrast; Histogram analyzes the histogram for a region defined by the user; Save Histogram saves on disk the enhanced image.

The central part of the "Contrast" window presents the histograms and the transformations. You will be able to manipulate the histogram using the mouse. On the bottom of the window there are some parameters that change when you move the mouse over the histogram area. Check next the description.

Before you open the "Contrast" window, you should select an Image to be enhanced and present it on the active screen. Only images in gray levels can be selected for enhancement (a single image - band - or a set of three, making a color composite).

See next how to perform some operations:  

See also:

Learn more about Contrast Enhancement in SPRING
Image Processing Techniques


Histogram Manipulation

Histogram Operation:

  • select the Image (PI) to be manipulated. If you want only one image, click on an Information Layer on the "Control Panel" and then click on M (for monochromatic), or three different images in different channels to visualize the color composite (R, G and B);
  • click on Execute - Draw  on the main menu (if you want to see the image in another screen, choose a different one - 1-5 - on the "Display Control", items Show and Enable);
  • click on Image - Contrast... on the main menu;
  • in the dialog box "Contrast", select the contrast Operation you want: MinMax, Linear, Square Root, Square, Logarithm, Negative, Histogram Equalization, Slicing and Editing. See Contrast Operations;
  • manipulate the transformation curve as you wish ( see how to manipulate the histogram);
  • click on Apply to see the Image enhancement on the enabled screen.

NOTE: You always have to click on Apply to see the image transformation.


Options for Contrast Enhancement


Transformations

The manipulation on the transformation curve is done in each Channel individually, either monochromatic (only an Image on gray levels) or color composite (R - red, G - green or B - blue), each band in a channel.


How to move the enhancement equation:

  • present an Image on the enabled screen as described above;
  • select an Operation and a Channel;
  • click with the mouse LB in any place of the histogram area to move the left bottom of the curve;
  • click with the mouse RB in any place of the histogram area to move the right top of the curve;
  • Observe on the figure below that the drawing area presents simultaneously the Input histogram and the New one with the new distribution of gray levels;
  • after finding the best histogram, click on Apply to see the Image enhancement on the enabled screen.



NOTE: After executing the contrast, check if the Output and New Histograms have the same shape, until the curve position is changed again.

NOTE: This option of moving the edges of the curve is only valid from the following operations: MinMax, Linear, SquareRoot, Square, Logarithm and Negative. The operations Histogram Equalization, Executing Slicing in gray levels and Histogram Edition work differently.


Options for Contrast Enhancement


Histogram Parameters

When you move the mouse over the histogram area, some Image parameters are presented. The following figure shows these parameters when we have three bands (ILs) in a color composite.



Browsing the histogram:

  • present an Image on the enabled screen as described above;
  • select an Operation and a Channel;
  • move the mouse over the histogram x axis;
  • in Input Level you will see the values for the gray levels (between 0 and 255) referred to the mouse position;
  • in LUT/Population you will see the gray level values and corresponding amount of pixels as you move the mouse over the histogram. The presenting data depend on the option chosen on the View item, "Contrast" window. See Defining a region of the image and its histogram;
  • Mean refers only to the Input Image which is calculated when we opened the "Contrast" window, or in case we change any image on the "Control Panel";
  • Values refers to the exact value for the left part of the curve (Min:) and right (Max:). This is only valid for the following Operations: MinMax, Linear, SquareRoot, Square, Logarithm or Negative; See next How to change the minimum and maximum value for gray levels ;
  • the fields Edit(output) and Slices are used in the following operations described below.



Options for Contrast Enhancement


Showing the desired histogram

When you are manipulating histograms you can select which one you want to present. Check below the meaning of three types of histogram:

  • Input: corresponds to the histogram of the Image originally recorded on disk, i.e., the one you can not change unless you want to save the manipulated image over the original;
  • Output: corresponds to the histogram of an Image presented in one of the five enabled screens, enhanced or not;
  • New: corresponds to the current histogram presented on the "Contrast" window, that hasnīt been applied over the Image on the active screen. When you execute a contrast, the output and new histograms become the same, until you change again.



Selecting the type of histogram to be presented:

  • click on View on the window "Contrast" and choose the one of the options: None, Input, Output, New, In/Out, In/New or Out/New.


NOTE: The fields LUT/Population are automatically updated as well as the histogram.


Options for Contrast Enhancement


Changing the minimum and maximum value for gray levels

In case the user wants an exact value for the minimum and maximum values of the transformation, he can type these values instead of clicking with the mouse on the histogram.


Changing the minimum and maximum values:

  • present an Image on the enabled screen as described above;
  • select an Operation (MinMax, Linear, SquareRoot, Square, Logarithm or Negative) and a Channel;
  • type on the text boxes Min: and/orMax: the desired values and click on CR and the curve will be adjusted to these new values (check the figure below);
  • click on Apply.



Options for Contrast Enhancement


Resetting the histogram of the original image

At any time you will be able to reset the original image, i.e., go back without changing the gray levels of the Image presented on the active screen since you havenīt saved it on disk.


Resetting an original histogram:

  • click on Execute - Reset to recover the original Image.


NOTE: The original image is recovered with the default curve (Linear) and the minimum and maximum values go back to 0 and 255, respectively.


Options for Contrast Enhancement


Defining a region of the image and its histogram

It is also possible to define a histogram for a specific region of the image - use the mouse to define a rectangle over the drawing area.

Selecting a part of the Image:

  • activate the Zoom Cursor  in View on the main menu;
  • use the mouse left button (LB) and click on two diagonally opposite points (top left, bottom right) making a rectangle as if you were going to zoom the area;
  • click on Execute - Histogram on the window "Contrast". The new histogram will be presented showing the gray levels distribution for this area, for the selected Channel;
  • manipulate the transformation curve as you wish and apply the contrast ( see details above).


NOTE: Use the option Execute - Reset to recover the original image.

Options for Contrast Enhancement


Saving an enhanced image

It is possible to save the contrast change in three different ways:

    • as a Synthetic Image, i.e., one single colored Image (three bands blended with its associated color table - LUT or as a monochromatic sliced image;
    • as a Gray Levels Image (Band option), with its associated LUT. If the enhancement was applied in a composition of three bands, these will be saved as distinct information layers, each one with its own LUT;
    • as a Classified Image, associated to a colors table. This is only available for the Slicing operation, where the gray levels will be associated with the colors.



Saving the Image:

  • click on the field Name in Save Image and type a name for the output band. This will be a new Information Layer from the same category where the original image is;
  • choose between the Bands, Synthetic or Classif., depending on the Operation performed;
  • click on Execute - Save on the window "Contrast".

This enhanced image will be available at the Control Panel for other options of image processing.



Options for Contrast Enhancement


Executing Slicing in gray levels

The slicing in gray levels is considered one of the most simple ways of classification because it is applied only in one spectral band.


Gray levels slicing:

  • click on Operation - Slicing and choose a type: Normal, Equidistribute or Rainbow;
  • observe that the histogram presents the Operation chosen.

Informing the number of slices:


Histogram Edition

The user can edit the curve in the shape he wants.


Editing a histogram:

  • click on Operation and select Editing and then choose an option: Remove, Add or Move .

NOTA: the first time you perform the Edition operation, the line shown on the drawing area presents three predefined points.


To move one point on the line:

  • click on Operation and select Editing - Move;
  • press and hold the mouse LB on any point of the line and drag the mouse moving the point to another position;
  • release the mouse LB and observe that the new histogram is automatically recalculated.


To add a point to the line:

  • click on Operation and select Editing - Add;
  • place the cursor on the region of the line you wish to add a point;
  • clique the mouse LB to add the point.

NOTE: To insert more than one point, click clique the mouse LB where you want the new point to be.


To remote a point on the line:

  • click on Operation and select Editing - Remove ;
  • clique the mouse LB at the point on the line to be removed.



Options for Contrast Enhancement


Enhancing color composite

All the contrast options available for enhancing a band on the monochromatic Channel, can also be applied individually for each band on a colored composite. The outcome can be seen simultaneously. The option Slicing is not available here.


Enhancing color composite:

  • in the "Control Panel", select the images (ILs) to be manipulated, putting each one on channels R (red), G (green) and B (blue). You can not use a synthetic image;
  • click on Execute - Draw  on the display you want to present the Image (1 to 5), enabling it;
  • click on Image, and select the option Contrast on the main menu;
  • select on the "Contrast" window on of the available Operations;
  • select on the item Channel one of the options (Red, Green or Blue). Observe that for each Channel, the Input histogram is presented on the correspondent color;
  • execute the best enhancement for each band and click on Apply every time you want to see a new outcome.


If you are happy with the enhancement obtained you can save the bands individually or transform the colored image into a synthetic one (see Saving an enhanced image).

See also:
Concepts about Contrast