Log Transformation

A log transformation maps a narrow range of low-intensity values in the input into a wider range of output levels. The general form of log transformation is 

S = C * log( 1 + r)

Where S is the output pixel value, C is a constant and r is the intensity of the image in the range [0, L-1]. 

Example 2:

Matlab




% Matlab Code for Log Transformation
  img = imread('Sampleimage.jpg');
 
% Convert datatype to Double
% (for allowing fractional values)
  r = double(img);
 
% Constant determining the
% nature of the log curve
  C = 1;
 
% Performing log transformation
  S = C * log(1 + r);
  T = 255/(C * log(256));
 
% Converting the datatype back
% to integer for displaying
  B = uint8(T * S);
  figure,imshow(B); title('Log Transformation');


Output:

 

 

The resultant image is one that appears way more bright than the original. This method could be used to brighten images that are dominated by dark regions. The limitation of Log transformations is that they are very limited in usage. Such that the Log transformations can accomplish this compressing of intensity levels in an image, but the power-law transformations discussed later are much more versatile for this purpose.

MATLAB – Intensity Transformation Operations on Images

Intensity transformations are among the simplest of all image processing techniques. Approaches whose results depend only on the intensity at a point are called point processing techniques or Intensity transformation techniques. Although intensity transformation and spatial filtering methods span a broad range of applications, most of the examples in this article are applications to image enhancement. In this article, you will learn how to apply Intensity transformation operations on images using MATLAB. 

In this article we will be going over the following intensity transformation functions:

  • Image Negatives
  • Log Transformations
  • Gamma Transformations

For the demonstration the following images would be used:

 

 

Similar Reads

Image Negatives:

To find the negative of an image we will be using the negative transformation function which has the form:...

Log Transformation:

...

Power Law Transformation:

A log transformation maps a narrow range of low-intensity values in the input into a wider range of output levels. The general form of log transformation is...