Image sampling and quantization

Project goal

You are given an image of size \(M \times N\) and \(k\) bits are used for the intensity resolution. How do you resample the image? For example, you want to shrink the image size to \(M/2 \times N/2\) or enlarge the image to \(2M \times 2N\) size. Also, you want to reduce the image storage requirements by decreasing the number of bits used for intensity resolution. How do you accomplish these tasks?

Project description

Natural images are modeled by continuous functions. However, to enable their processing using computers, continuous images are converted to digital form by projecting them onto sensor arrays. Image sampling and quantization are the two parameters that control the image quality during the digitization process.

Consider a digital image \(f(x,y)\) represented by a \(M \times N\) matrix. Each element in this matrix is referred to as a pixel. For a \(2D\) image, sampling refers to the total number of pixels in the image, which in turn is determined by the number of rows and the number of columns.

\[f(x,y) = \begin{bmatrix} f(1,1) & f(1,2) & \cdots & f(1, N) \\ f(2,1) & f(2,2) & \cdots & f(2, N) \\ \vdots & \vdots & \vdots & \vdots \\ f(M,1) & f(M,2) & \cdots & f(M, N) \\ \end{bmatrix}\]

There are \(N\) samples in each row of \(f(x,y)\). We have \(M\) rows, and the total number of pixels is \(M \times N\). In other words, the \(2D\) image is sampled at \(M \times N\) spatial locations.

A quantization scheme determines the values of \(f(x,y)\). For example, if we use one bit for quantization, we can only store two (\(2^1\)) different values for any \(f(x,y)\) – 0 or 1. On the other hand, if we use 4 bits for quantization, we can store sixteen (\(2^4\)) different values for any \(f(x,y)\). The number of bits used for quantization is referred to as the intensity resolution.

In general, image quality increases as we increase the number of samples (i.e., sampling rate or spatial resolution) and the intensity resolution. However, increasing the spatial resolution and the intensity resolution increases the storage requirements. The storage required for an \(M \times N\) image with \(k\) bits for intensity resolution is \(M \times N \times k\) bits.

Image interpolation

Image interpolation is the process of estimating pixel values at unknown locations using the pixel values at known locations. Image interpolation is a widely used technique for tasks such as zooming, shrinking, rotating, and geometric corrections.

Image interpolation techniques include nearest neighbor interpolation, linear interpolation, bilinear interpolation, and bicubic interpolation.

High-level solution steps

  1. Using a digital camera, capture images of the same object using different spatial resolutions – for example, \(512 \times 512\), \(1024 \times 1024\), \(2048 \times 2048\), and \(4096 \times 4096\).

  2. Capture images by varying the intensity resolution for each image size in step 1 above. For example, choose intensity resolution by setting \(k = 8, 16, 24\).

  3. Now you have a total of \(4 \times 3 = 12\) images of the same object. Assess qualitatively the effects of both spatial resolution and intensity resolution on visual quality of images.

  4. Use the following interpolation techniques for image shrinking and image enlargement: nearest neighbor interpolation, linear interpolation, bilinear interpolation, and bicubic interpolation.

  5. Compare and contrast the effectiveness of different interpolation techniques for image shrinking and image enlargement. Also, consider the computational complexity of the interpolation algorithms when comparing their effectiveness.

Running/testing the solution

List the sequence of steps you have used for comparing and contrasting the effectiveness of different interpolation techniques. Also, describe your conclusions.

Reflecting on the learning experience and teamwork

Reflect on your solution to the problem and the learning experience through this project. Trust building, connectedness, and psychological safety are the foundational elements of teamwork. Reflect on the team dynamic experienced in this project.

Team member contribution/effort assessment

Use the following rubric to rate yourself and your teams members on a scale of 1 to 5 about their individual contribution to the project (a rating of 1 being poor and 5 being outstanding). Also, please provide rationale for each rating.

Self-assessment Assess team member 1 Assess team member 2
Responsibilities/ Performance Rating Rationale Rating Rationale Rating Rationale
Attended classes and group meetings
Initiated communication and interaction with group members
Contributed and committed to the group project
Provided comments and feedback in group work
Demonstrated a positive attitude towards to the project
Any other comments

Rubric for self-assessment and grading

Use the following rubric for self-assessment and peer grading. Also, the instructor will use the same rubric for grading the project. The final grade for the project will be based on scores from the self-assessment, peer-grading and instructor grading.

Good Fair Poor
Conformance to Specifications (40 points) The program works correctly and meets all of the specifications. (40 points). The program works correctly but implements less than 50% of the specifications. (30 points) The program produces incorrect results or does not compile. (10 points)
Data Structures and Algorithms (20 points) Appropriate and efficient data structures and algorithms are used. (20 points) The data structures and algorithms used get the job done but they are neither a natural fit nor efficient. (10 points) Solution is based on brute force approach. No consideration is given to selection of suitable data structures and algorithms. (5 points)
Testing (20 points) Coverage of test cases is comprehensive. Following information is provided for test cases: inputs, expected results, pass/fail, and remarks.(20 points) Coverage of test cases is low. Test case documentation is incomplete. (10 points) Cursory treatment of testing. No documentation of test cases. (5 points)
Coding (10 points) The code is compact without sacrificing readability and understandability. (10 points) The code is fairly compact without sacrificing readability and understandability. (5 points) The code is brute force and unnecessarily long. (2 points)
Readability (5 points) The code is well organized and very easy to follow. (5 points) The code is readable only by someone who knows what it is supposed to be doing. (3 points) The code is poorly organized and very difficult to read. (1 points)
Documentation (5 points) The code is self-documenting and obviates the need for elaborate documentation. It is well written and clearly explains what the code is accomplishing and how. (5 points) The documentation is simply comments embedded in the code with some simple header comments separating functions/methods. (3 points) The documentation is simply comments embedded in the code and does not help the reader understand the code. (2 points)


Back to course home