Image Negatives

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

S = L – 1 – r

Where S is the output pixel value, L is a number of unique intensities and is the intensity of the image in the range [0, L-1]. 

The reason why we subtracted 1 from L is that L is the number of unique intensities present in a color channel. Therefore, in the case of an 8-bit image, the value of L would be 256. But since the intensities/color values start from 0, we subtract 1 from L to adjust the range.

Example 1:

Matlab




% MATLAB code for Intensity Transformation
  img = imread('Sampleimage.jpg');
 
% In case of 8 Bit image
  L = 256;
 
% The below operation is equivalent to 255 - img
  s = (L - 1) - img;
  figure,imshow(s); title('Inverted Image')


Output:

 

 

The image colors got inverted such that all the blacks turned to whites and vice versa. Reversing the intensity levels of a digital image in this manner produces the equivalent of a photographic negative. This process gives us the complement of the image. 

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...