1. Homepage
  2. Programming
  3. EBU6230 Image and Video Processing Coursework: PGM/PPM images, Equalization and Histogram modelling

EBU6230 Image and Video Processing Coursework: PGM/PPM images, Equalization and Histogram modelling

Engage in a Conversation
QMULEBU6230Image and Video ProcessingPPMPGMQuantizationSub-samplingLaplacian filtersHistogram modelling

  CourseNana.COM

EBU6230 – Image and Video Processing – 2023/24 CourseNana.COM

Coursework report and exercises CourseNana.COM

Name:                 _____________________ CourseNana.COM

Username:        _____________________ CourseNana.COM

Exercise 1 (a)

Reading/writing PGM/PPM imagesThe first step towards image and video processing is reading images from a file and write them to a file. There exist different standards that store the information in different formats; so before opening an image, knowledge of the standard is necessary. CourseNana.COM

Two widely used image formats are PPM and PGM. The PGM format is a greyscale file format designed to be easy to manipulate. A PGM image represents a greyscale graphic image. For most purposes, a PGM image can just be thought of as an array of integers. The name "PGM" is the acronym of "Portable Grey Map." The name "PPM" is the acronym for "Portable Pixel Map." Images in this format (or a precursor of it) were once also called "portable pixmaps." It is a highly redundant format, and contains a lot of information that the Human Visual System (HVS) cannot even discern. However, as for PGM, PPM is very easy to write and analyse. CourseNana.COM

The goal of the first part of today’s lab is to become comfortable with these two formats. You will implement functions to read and to write PPM and PGM images. The final demonstration of the implemented software will be done using the well-known test images: LENA, BABOON, PEPPERS, etc. You can find PPM and PGM versions of these images in the EBU6230 QMplus pages. The writing function must add as a comment in the header: “image created by your_name”. CourseNana.COM

Include in your submission the file resulting from reading the images provided and writing them back in their original format. CourseNana.COM

Summarize in 5 points the operations necessary to read a PGM/PPM image: CourseNana.COM

Summarize in 5 points the operations necessary to write a PGM/PPM image: CourseNana.COM

  1. What is the difference between the identifiers P3 and P6?

Exercise 1 (b)
CourseNana.COM

Format conversions: in this part of the lab, the images will be converted from colour to grey scale; in other words a PPM image will be converted to the PGM format. You will implement a function called “BUPT_format_converter” which transforms images from colour to grey-scale using the following YUV conversion: CourseNana.COM

Y =  0.257 * R + 0.504 * G + 0.098 * B + 16 CourseNana.COM

U = -0.148 * R - 0.291 * G + 0.439 * B + 128 CourseNana.COM

V =  0.439 * R - 0.368 * G - 0.071 * B + 128 CourseNana.COM

Note swap of 2nd and 3rd rows, and sign-change on coefficient 0.368 CourseNana.COM

What component represents the luminance, i.e. the grey-levels, of an image? CourseNana.COM

Use thee boxes to display the results for the colour to grey-scale conversion. CourseNana.COM

CourseNana.COM

Lena colour (RGB)  CourseNana.COM

Lena grey CourseNana.COM

CourseNana.COM

Baboon grey CourseNana.COM

Baboon colour (RGB) CourseNana.COM


Is the transformation between the two colour-spaces linear? Explain your answer. CourseNana.COM

Display in the box the Lena image converted to YUV 3 channels format. CourseNana.COM

Are the colours of the previous picture distorted? If yes why? CourseNana.COM

Based on the formula for the RGB to YUV conversion, derive the formula for the YUV to RGB conversion. CourseNana.COM

Use the formula you derived at the previous step to convert the YUV image back to the original RGB format. Display the result in the box. CourseNana.COM

Exercise 1 (c)

Sub-samplingThe HVS is incapable of perceiving certain details in an image. Therefore high compression ratios can be achieved by exploiting the characteristics of the HVS, thus discarding what has a low visual relevance. However, this process can introduce distortions due to the compression. A simple way to exploit the characteristics of the HVS to give compression is to sub-sample an image. A drawback of this approach is that it is possible to incur the well-known problems of a discrete representation, such as aliasing. This part of the lab covers some simple sub-sampling operations. CourseNana.COM

Implement a function that sub-samples grey level images by a factor n, with n a multiple of 2. The function should be able to sub-sample independently in the horizontal and in the vertical direction or in both directions at the same time. CourseNana.COM

Display the results of sub-sampling the image Lena using the following factors: 2 horizontal, 2 vertical, 2 vertical and 8 horizontal, 4 vertical and 4 horizontal. Include the files of the results in the submission. CourseNana.COM

Box for the 4 images CourseNana.COM

Describe, using your own words, the aliasing problem and how to avoid it, as applied to signal processing CourseNana.COM

Given a scene sampled by a ccd sensor with minimum horizontal sampling frequency 10cm-1, what is the maximum horizontal frequency in the image that can be correctly represented? CourseNana.COM

Paste below a clear example of artefacts generated by aliasing. For this task you can use your own choice of image. Use the box below for the image and comments.  CourseNana.COM

Exercise 2 (a)

Quantize: Quantization is the process of approximating the continuous values in the image data with a finite set of discrete values. The input of a quantizer is the original data and the output is one among the finite number of levels. This process is an approximation, and a good quantizer is one which represents the original signal with minimum loss (quantization error). In this lab, you will work with a scalar uniform quantizer applied to grey-scale images. CourseNana.COM

CourseNana.COM

Lena, quantization factor 2 CourseNana.COM

Implement a function that uniformly quantizes grey level images. The function will allow the reduction of the number of grey level values by a given factor n (a power of 2).
Note. To visualize the image, you need to re-map it in the 8-bit-per-pixel representation. Show the results in the boxes below.

CourseNana.COM

CourseNana.COM

Baboon, quantization factor 8 CourseNana.COM

CourseNana.COM

Peppers, quantization factor 128 CourseNana.COM

Peppers, quantization factor 32  CourseNana.COM

Is quantization a reversible process? Can you recover what you discarded? Briefly explain. CourseNana.COM

Write the results back to PGM/PPM files using the function you created. Make sure that your writing function allocates the correct number of bits per pixel. What is the size of the files compared with the original? Given the results, what is a typical application field for quantization? Include in your submission the output files and comment on the results.

Exercise 2 (b)

Histograms: This part of the lab is dedicated to image processing using histograms. A histogram is a statistical representation of the data within an image. The histogram can be represented as a plot of the frequency of occurrence of each grey level. This representation shows the distribution of the image data values. By manipulating a histogram, it is possible to improve the contrast in an image and the overall brightness or to segment different areas of the image by applying one or more thresholds to the histogram itself. CourseNana.COM

Implement a function to output the histogram values of a given grey level image. Display in the boxes the resulting histograms. CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

If you normalize the values of the histogram so that they sum to 1, what does the value of a bin represent? CourseNana.COM

Exercise 2 (c)

Equalize: Equalization is one of the possible image processing algorithms implemented using histograms. Histogram equalization allows a user to enhance the contrast of images. Histogram equalization employs a monotonic, non-linear mapping which re-assigns the intensity values of pixels in the input image such that the output image contains a uniform distribution of intensities (i.e. a flat histogram). CourseNana.COM

Implement a function that equalizes grey-scale images based on their histogram. The input is a given grey level image; the output is the derived image with uniform intensity distribution. CourseNana.COM

Display in the boxes the equalized images and their histograms. CourseNana.COM

  CourseNana.COM

Lena equalized CourseNana.COM

  CourseNana.COM

Baboon equalized CourseNana.COM

  CourseNana.COM

Peppers equalized CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Lena histogram after equalization CourseNana.COM

  CourseNana.COM

Baboon equalized after equalization CourseNana.COM

  CourseNana.COM

Peppers equalized after equalization CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Are the distributions really uniform? Explain your results. CourseNana.COM

Show an example of the successful application of histogram equalization to image enhancement. You can use an appropriate image of your choice CourseNana.COM

Enhanced image  CourseNana.COM

CourseNana.COM

Comment on the results of the previous step CourseNana.COM

Exercise 2 (d)

Histogram modelling:  Histogram modelling techniques are effective tools for modifying the dynamic range and contrast of an image. Unlike contrast stretching, histogram modelling operators may employ non-linear and non-monotonic transfer functions to map between pixel intensity values in the input and output images. In the first part of this lab you will model the histogram of a grey-scale image. CourseNana.COM

Implement a point to point operation that maps the input grey level image into an output image which has a predefined frequency distribution. The algorithm is not given explicitly in the lecture slides, you are supposed to derive it. Use as input histogram the histogram of an image A and model the histogram of another image B according to the input. CourseNana.COM

(A = Lena) (B=Peppers) CourseNana.COM

CourseNana.COM

Histo of A CourseNana.COM

Histo of B CourseNana.COM

CourseNana.COM

B after Modelling CourseNana.COM

Histo of B after modelling CourseNana.COM

CourseNana.COM

Use as input histogram an approximation of the exponential distribution. CourseNana.COM

CourseNana.COM

Image Peppers  CourseNana.COM

Peppers after modelling CourseNana.COM

Histo after modelling CourseNana.COM

CourseNana.COM

Write in the box the formulation of your algorithm. CourseNana.COM

Exercise 3 (a)

Negatives: We are used to the negative of an image in analogue image processing. It is possible to generate a negative from a digital image too. In the last part of today’s lab you will solve a simple exercise on negative images. CourseNana.COM

Write a function that inverts the grey level of a PGM image (i.e. it creates the negative of the image). CourseNana.COM

CourseNana.COM

Negative of Peppers CourseNana.COM

Negative of Baboon CourseNana.COM

Negative of Lena CourseNana.COM


Perform the same task with PPM images and comment on the results. CourseNana.COM

CourseNana.COM

Negative of Peppers CourseNana.COM

Negative of Baboon CourseNana.COM

Negative of Lena CourseNana.COM

 

Your comments: CourseNana.COM

Exercise 3 (b)

Rotation and translation. Image processing toolboxes allow a user to rotate, translate and skew images. These are very useful operations for image composition, for example. The first exercise will cover the implementation of two such transformations. CourseNana.COM

Write a function BUPT_transform that takes as input an image I, rotates it with an angle θ1 and skews it with a second angle, θ2. CourseNana.COM

Write the matrix formulation for image rotation (define all variables). CourseNana.COM

Write the matrix formulation for image skewing (define all variables). CourseNana.COM

Create and paste below a PGM image containing your name written in Arial font, point 72, uppercase letters. CourseNana.COM

CourseNana.COM

Your image  CourseNana.COM

CourseNana.COM

-50 CourseNana.COM

Rotate the image you created by 30, 60 120 and -50 degrees clockwise and display the results below.

CourseNana.COM

CourseNana.COM

During the development process have you experienced the problem of regular patterns of black pixels in the image? If so, explain how you solved the problem. Otherwise imagine what could have generated these artefacts and how you would have worked around them.
CourseNana.COM

Rotate the image by 20 degrees clockwise and then skew the result by 50 degrees. Display the result in ‘a’. CourseNana.COM

Skew the image by 50 degrees and then rotate the result by 20 degrees clockwise. Display the result in ‘b’. CourseNana.COM

a CourseNana.COM

b CourseNana.COM

Analyse the results when you change the order of the two operators i.e. R(S(I)) and S(R(I)), where R is the rotation and S is the skew. Are the results of (a) and (b) the same?  Why?  CourseNana.COM

Exercise 4 (a)

Noise and PSNR: This part of the lab introduces error metrics for image quality evaluation. Two common metrics are the Mean Square Error (MSE) and the Peak Signal to Noise Ratio (PSNR). The MSE is the cumulative squared error between the processed image and the original image. The PSNR makes use of the MSE. The smaller the MSE, the smaller the error is. The larger the PSNR, the smaller the error is. You will add different amounts of random noise to the test images and measure their MSE and PSNR. CourseNana.COM

Write the formulas of MSE and PSNR. CourseNana.COM

Can the PSNR return a negative value? Explain your answer. CourseNana.COM

Create a function that can add (i) salt and pepper noise and (ii) Gaussian noise to a PGM image and compute PSNR and MSE. Show the results in the box and write under the box the values of MSE and PSNR comparing the original with the corrupted one. CourseNana.COM

CourseNana.COM

Peppers Gaussian noise CourseNana.COM

σ =5% of the range. CourseNana.COM

Baboon Gaussian noise CourseNana.COM

σ =10% of the range. CourseNana.COM

CourseNana.COM

Baboon salt and pepper noise   CourseNana.COM

CourseNana.COM

Peppers salt and pepper noise   CourseNana.COM

CourseNana.COM

Lena Gaussian noise CourseNana.COM

σ =1% of the range. CourseNana.COM

CourseNana.COM

Lena salt and pepper noise   CourseNana.COM

CourseNana.COM

Lena Gaussian noise CourseNana.COM

σ =5% of the range. CourseNana.COM

CourseNana.COM

Peppers Gaussian noise CourseNana.COM

σ =2% of the range. CourseNana.COM

CourseNana.COM

Baboon Gaussian noise CourseNana.COM

σ =7% of the range. CourseNana.COM

CourseNana.COM

CourseNana.COM

Exercise 4(b)

Up-sampling: Scaling-up an image (up-sampling) requires the filling of the new positions given the original pixels. This filling can be obtained by interpolation. Different interpolation techniques can be used. The choice depends on the quality we want to achieve and on the computation resources we have available. The nearest-neighbour interpolation is the simplest and fastest technique, but it is also a technique achieving low quality results. Bilinear interpolation is computationally more intensive, but it achieves higher quality results. CourseNana.COM

Implement the function BUPT_up that increases the resolution of images by a given factor (also a non-integer one). The up-sampling should be achieved using the nearest neighbour as well as the bilinear interpolation. The function will be able to up-sample independently in the horizontal and in the vertical direction or in both directions simultaneously. CourseNana.COM

Up-sample the image Lena using nearest neighbour interpolation. Display a blow-up of the image Lena obtained by up-sampling the original image with factor 4.5. The image should clearly show the type of artefact obtained using the nearest neighbour interpolation. Use the box below to display the image and discuss the results. CourseNana.COM

CourseNana.COM


CourseNana.COM

Your comments: CourseNana.COM

CourseNana.COM

  CourseNana.COM

CourseNana.COM

Up-sample the image Baboon using bilinear interpolation. Paste below a zoomed portion of the image Baboon obtained by up-sampling the original image with a factor 3.6. Discuss the artefacts obtained using bilinear interpolation. CourseNana.COM

CourseNana.COM

  CourseNana.COM

CourseNana.COM

Your comments: CourseNana.COM

CourseNana.COM


CourseNana.COM

CourseNana.COM

Compare the nearest neighbour technique and the bilinear technique in terms of speed and accuracy. Which technique is faster? Why? What artefacts are more visually disruptive? CourseNana.COM

CourseNana.COM


CourseNana.COM

CourseNana.COM

Exercise 5(a)

Low pass filtering: Image filtering generates a processed image as a result of certain operations on the pixels of the original image. Each pixel in the output image is computed as a function of one or several pixels in the original image, usually located near the output pixel. The procedure is usually implemented by convolving a kernel with desired properties with the pixels of the input image. If the kernel is a Gaussian kernel, then the behaviour of the filter depends on the variance of the Gaussian. CourseNana.COM

Write a function BUPT_lowpass that convolves an image with a Gaussian kernel. CourseNana.COM

(i) Write the formula of the kernel you used. CourseNana.COM

(ii) The 2D Gaussian kernel is separable: write the two separate equations for the rows and the columns, and discuss the advantages of using separable filters. CourseNana.COM

(iii) What is the relationship between σ and the cut-off frequency of the filter? CourseNana.COM

(iv) Given σ, what criterion should be used to choose the size of the kernel? Why? CourseNana.COM

CourseNana.COM


CourseNana.COM

Your comments: CourseNana.COM

CourseNana.COM

Add Gaussian noise to the image Lena with noise power 50 dBm, then convolve the noisy image with Gaussian kernels with σ = 0.5, 1, 2, 4, 7, 10, respectively. Paste below the resulting images. Comment the results obtained with increasing values of σ. CourseNana.COM

CourseNana.COM

σ=1 CourseNana.COM

σ=2 CourseNana.COM

CourseNana.COM

σ=4 CourseNana.COM

CourseNana.COM

σ=10 CourseNana.COM

CourseNana.COM

σ=7 CourseNana.COM

CourseNana.COM

σ=0.5 CourseNana.COM

CourseNana.COM


CourseNana.COM

Your comments: CourseNana.COM

CourseNana.COM

  CourseNana.COM

Implement a rectangular-shaped filter (BUPT_rect). Filter the noisy image Lena with a 5-by-5 and with a 7-by-7 kernel. Paste below the resulting images. Compare these results with those obtained with the Gaussian filter. CourseNana.COM

CourseNana.COM

5-by-5 pixel CourseNana.COM

7-by-7 pixel CourseNana.COM


CourseNana.COM

Your comments: CourseNana.COM

CourseNana.COM


CourseNana.COM

CourseNana.COM

Exercise 5(b)

Edge Detection: Edge detection is the process of identifying and locating discontinuities in an image. The discontinuities are sharp changes in pixel intensity which characterise object boundaries. Classical edge detectors convolve the image with a 2-D kernel designed to be sensitive to large gradient amplitudes. There exist a large number of edge detectors, each designed to be sensitive to certain types of edges. CourseNana.COM

Implement the Sobel, Roberts and Prewitt filters for grey level and colour images. In the case of colour images, you can apply separate filtering of each of the three RGB components. Paste below the images representing the absolute value of the gradient for the three filters. Comment on how you dealt with the borders. CourseNana.COM

CourseNana.COM

Sobel Peppers (colour) CourseNana.COM

Sobel Lena (grey) CourseNana.COM

CourseNana.COM

CourseNana.COM

 Exercise 6 CourseNana.COM

LoG. Laplacian filters are derivative filters used to find edges in images. Since derivative filters are very sensitive to noise, it is common to smooth the image before applying the Laplacian. For example, the image can be smoothed using a Gaussian filter. The two-step process involving Gaussian low-pass filtering followed by Laplacian filtering is called the Laplacian of Gaussian (LoG) operator and will be covered in the first part of the lab. CourseNana.COM

CourseNana.COM

Peppers σ = 3 CourseNana.COM

Discussion CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
QMUL代写,EBU6230代写,Image and Video Processing代写,PPM代写,PGM代写,Quantization代写,Sub-sampling代写,Laplacian filters代写,Histogram modelling代写,QMUL代编,EBU6230代编,Image and Video Processing代编,PPM代编,PGM代编,Quantization代编,Sub-sampling代编,Laplacian filters代编,Histogram modelling代编,QMUL代考,EBU6230代考,Image and Video Processing代考,PPM代考,PGM代考,Quantization代考,Sub-sampling代考,Laplacian filters代考,Histogram modelling代考,QMULhelp,EBU6230help,Image and Video Processinghelp,PPMhelp,PGMhelp,Quantizationhelp,Sub-samplinghelp,Laplacian filtershelp,Histogram modellinghelp,QMUL作业代写,EBU6230作业代写,Image and Video Processing作业代写,PPM作业代写,PGM作业代写,Quantization作业代写,Sub-sampling作业代写,Laplacian filters作业代写,Histogram modelling作业代写,QMUL编程代写,EBU6230编程代写,Image and Video Processing编程代写,PPM编程代写,PGM编程代写,Quantization编程代写,Sub-sampling编程代写,Laplacian filters编程代写,Histogram modelling编程代写,QMULprogramming help,EBU6230programming help,Image and Video Processingprogramming help,PPMprogramming help,PGMprogramming help,Quantizationprogramming help,Sub-samplingprogramming help,Laplacian filtersprogramming help,Histogram modellingprogramming help,QMULassignment help,EBU6230assignment help,Image and Video Processingassignment help,PPMassignment help,PGMassignment help,Quantizationassignment help,Sub-samplingassignment help,Laplacian filtersassignment help,Histogram modellingassignment help,QMULsolution,EBU6230solution,Image and Video Processingsolution,PPMsolution,PGMsolution,Quantizationsolution,Sub-samplingsolution,Laplacian filterssolution,Histogram modellingsolution,