Practical No. 2
Practical No. 2
Aim :
Consider any image with size 1024*1024. Modify the image to the sizes 512*512,256*256,
128*128, 64*64 and 32*32 using subsampling technique. Create the original image from all the
above subsampled images using resampling technique. Read any image. Display the histogram,
Equalized histogram, and image with equalized histogram.
Objective: RGB
images of size 1024*1024
Theory:
In Digital Image Processing, signals captured from the physical world need to be translated into
become suitable for digital processing, an
image function f(x,y) must be digitized both spatially and in amplitude. This digitization process
involves
The subsampling was accomplished by deleting the appropriate number of rows and columns
from the original image. For example, the 512*512 image was obtained by deleting every other
row and column from the 1024*1024 image. The 256*256 image was generated by deleting
every other row and column in the 512*512 image, and so on. The number of allowed gray
levels was kept at256. These images show the dimensional proportions between various
sampling densities, but their size differences make it difficult to see the effects resulting from a
reduction in the number of samples. The simplest way to compare these effects is to bring all the
subsampled images up to size 1024*1024 by row and column pixel replication.
Quantization is opposite to sampling. It is done on y axis. When you are quantizing an image,
you are actually dividing a signal into quanta (partitions). On the x axis of the signal, are the co-
ordinate values, and on the y axis, we have amplitudes. So digitizing the amplitudes is known as
Quantization.
Procedure
6.Read and load the images obtained in the previous step of sizes 512*512, 256*256,
128*128,64*64, 32*32. (One by one).
8.Resize the input image to resample it, using the cv2.resize() function by passing the input
image and output size as parameters.
Histogram Equalization
The histogram technique that is used to enhance the brightness and contrast of an image is
histogram equalization. The goal of histogram equalization is to distribute the gray levels within
an image so that every gray level is equally likely to occur. In other words, histogram
uniformly distributed. Histogram equalization will increase the brightness and contrast of a dark
and low contrast image, making features observable that were not visible in the original image.
about the range of
gray levels, all images will have approximately the same brightness and contrast, hence allowing
images to be compared equally without a bias due to perceived contrast and brightness
differences.
Conclusion:
We have successfully modified the image to the sizes 512*512, 256*256, 128*128,64*64 and
32*32 using subsampling technique and create the original image from all the subsampled
images using resampling technique and also display equalized histogram for the images