Navigation

Related Articles

Back to Latest Articles

C# Tutorial: Contrast Stretching with Normalization


Andraz Krzisnik
C# Tutorial: Contrast Stretching with...

This post is a short revision of Contrast Stretch post we already worked on in the past. Where we talked about histogram equalization, which is a little more complex method than normalization.

What is Normalization?

Normalization in image processing is a process that changes the ranges of intensities in an image. For example let’s say we have a grayscale image which has the lowest intensity value of 50 and the highest the value of 120.

This image appears to be very “washed out”. So to enhance it, we will use normalization technique that will change the intensities’ range from 50 – 120 to 0 – 255.

Normalization takes each pixel and recalculates a new intensity value individually.

Equation for Normalization

Pout = (Pin – c) * (b – a) / (d – c) + a

Where Pout and Pin are variables for pixel values on the output and input of the equation.

b and a represent  values for the new range of intensities we are trying to get (a is the minimum and b is the maximum value).

d and c are the maximum and minimum intensity values of our input image.

Contrast Stretching

As I mentioned before there is already a post on contrast stretching. But I feel the method we are describing here is much easier for those who are still new to image processing.

Although this technique may not be as efficient as the one we already described – histogram equalization, results can still be satisfactory to a certain degree.

Function for demonstration of Normalization

This entire project is available for download here

Download Project

 

Show Comments (0)

Comments

Related Articles

C# Tutorial

Histogram Equalization And Magic Behind It

This tutorial is meant to demonstrate how histogram equalization works. This is a continuation on contrast stretch articles I’ve made in the past. An article on histogram...

Posted on by Andraz Krzisnik
C# Basics

C# Basics – Random Numbers, Chars and Strings – Part 7

Random Numbers To generate a random number, we will use a constructor called Random. Then to generate a random number we will use either .Next() or .NextDouble() function. Random...

Posted on by Andraz Krzisnik