0% found this document useful (0 votes)
47 views3 pages

Image Processing Techniques Overview

The document provides instructions for an image processing project involving a sunflower image. It outlines the following key tasks: 1) Import the sunflower image and extract the red, green, and blue channels. Produce a black and white version and implement contrast changes. Rotate the image 90 degrees clockwise. 2) Perform image compression using singular value decomposition (SVD). Calculate the condition number of the image matrix and remove singular values below thresholds to compress the image at different levels, showing the results. Research criteria for determining how many singular values to remove for image compression.

Uploaded by

hassan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views3 pages

Image Processing Techniques Overview

The document provides instructions for an image processing project involving a sunflower image. It outlines the following key tasks: 1) Import the sunflower image and extract the red, green, and blue channels. Produce a black and white version and implement contrast changes. Rotate the image 90 degrees clockwise. 2) Perform image compression using singular value decomposition (SVD). Calculate the condition number of the image matrix and remove singular values below thresholds to compress the image at different levels, showing the results. Research criteria for determining how many singular values to remove for image compression.

Uploaded by

hassan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Image Processing Project (Due April 18, 2023)

Note: All code used in the project must be attached to the project file.

1. (IMPORTING AND PLAYING AROUND) Import the follow-


ing “sunflower” image into a matrix, see Figure 1. When you import
the jpeg, it will be encoded in 8-bit numbers (minimum 0 and maximum
255). Also, the image will have red, green, and blue channels, so it will
be an 853 × 640 × 3 array, lets call it A. We can extract the R channel
by taking A(1 : 853, 1 : 640, 1), the G channel by A(1 : 853, 1 : 640, 2)
and the B channel by A(1 : 853, 1 : 640, 1).
Note: if you are using Matlab, we will do image processing in either
double (colors normalized out of 1) or uint8 (out of 255).

(a) Produce a black and white version of the sunflower image.


(b) How can I change the contrast? That is, how do I make the dark
more dark and the light more light? Implement a contrast change.
Commentary: You choose how to do this. Maybe you could con-
sider a hyperbolic tangent function (?), properly scaled of course.
(c) Rotate the image clockwise by 90◦ .
(d) Why is rotating by, say, 40◦ so difficult? Imagine the row and
column number of an entry of the matrix as a location in R2 . You
will need to center the image about the origin, and then apply a
40◦ rotation matrix to each (x, y)-coordinate. This will give you
the new locations of each pixel. However, now you have to create a
new large Cartesian grid which bounds the rotated image in order
to put the new locations into a new image matrix. The new large
grid points will not align exactly with the rotated grid points.
Thus, we need to carry over the information about the rotated
image onto a new grid that does not align exactly. Explain how

1
Figure 1: Sunflower

2
to overcome this difficulty. (For this problem, you do not
have to code this up, but must explain how to do it.)

2. (COMPUTATIONAL PROBLEM) Now, we will perform image


compression using the singular value decomposition. The singular value
decomposition can be used for image compression because it can pro-
duce the best (with respect to a matrix norm) rank-r approximation
to a given matrix. That is, if your objective is to reduce the amount
of memory that an image takes up, one way to do it is to reduce the
rank of the image matrix. This is done best with the singular value
decomposition.
Let’s look at the full singular value decomposition of the image matrix
(for example, the R, G, and B channels separately). That is, we need
all three matrices in the decomposition:

A = U ΣV T (1)

Note: in Matlab, we find the full SVD of a matrix A by typing:

[U, S, V ] = svd(A); (2)

(a) What is the condition number of the matrix A? That is, what is
the ratio of the largest to smallest singular value of A?
(b) Cut off all singular values below 0.01σ1 , where σ1 is the largest
singular value. Show the image result. It should look very similar
to the original image (but slightly compressed). What percentage
of the singular values have been removed?
(c) Cut off all singular values below 0.1σ1 and show the result. Now,
we should observe some degradation of the image, although it still
resembles a sunflower. What percentage of the singular values
have been removed?
(d) Go online and try and find a criterion for how many singular values
you should remove to do image compression and explain why this
is a good criterion for the application we have in mind.

Common questions

Powered by AI

The size of the singular values plays a crucial role in the accuracy and efficiency of image compression. Larger singular values correspond to more significant features of the image, contributing more to its fidelity. By retaining larger singular values and removing smaller ones, the image's core structure and quality can be preserved while reducing the file size. This makes image compression efficient by concentrating storage on the most impactful data .

Using different data types in Matlab, such as double and uint8, affects image processing as they dictate how pixel values are interpreted and manipulated. Double data type normalizes the color values between 0 and 1, offering precise control for mathematical operations and transformations, whereas uint8 values range from 0 to 255, reflecting standard image display standards. The choice between them influences computational precision and the range of operations available for transformation and analysis, significantly impacting processing outcomes .

The condition number of a matrix in the context of SVD is the ratio of the largest singular value to the smallest singular value of that matrix. It is an indicator of the sensitivity of the system of linear equations to changes or errors in data. Large condition numbers imply potential instability and inaccuracies in solutions .

Cutting off singular values below 0.01σ1 results in an image that looks very similar to the original with minimal compression effects, as only a small percentage of singular values are removed. However, cutting off singular values below 0.1σ1 leads to noticeable image degradation despite reducing more singular values, suggesting that careful selection of cut-off thresholds is crucial for balancing image quality and compression .

The singular value decomposition (SVD) is recommended for image compression because it produces the best rank-r approximation to a given matrix with respect to a matrix norm. This technique reduces the image matrix's rank, thereby reducing memory usage while maintaining image quality. Specifically, the image's R, G, and B channels can be decomposed using SVD for effective compression .

Rotating an image by 40° is challenging because it involves transforming each pixel's location represented by matrix rows and columns into new coordinates using a rotation matrix. After rotation, the new pixel locations must be placed on a Cartesian grid that bounds the rotated image, but the original and rotated grids do not align exactly. To overcome this, one must map the rotated grid points to the closest points on the new grid, which typically involves interpolation techniques to accurately transfer pixel information to the new locations .

Determining how many singular values to remove should consider the application requirements for image compression. One must evaluate the trade-off between file size reduction and image quality. Online resources suggest criteria based on visually acceptable levels of image degradation or retaining a certain percentage of energy captured by the largest singular values to maintain specific quality thresholds. These criteria are essential for achieving effective image compression while preserving adequate quality .

In Matlab, the command for performing singular value decomposition on a matrix A is [U, S, V] = svd(A). This command decomposes the matrix A into three components: U (an orthogonal matrix), S (a diagonal matrix containing the singular values), and V (another orthogonal matrix). These components represent the matrix in terms of its singular value decomposition .

Using a Cartesian grid in the process of rotating an image is important because it allows for mapping the new coordinates of each pixel after rotation. Since the original grid used for positioning pixels no longer aligns with their new positions due to rotation, a new Cartesian grid helps in accurately positioning these pixels by providing a structured framework. This ensures that the image retains coherence and avoids misalignments or distortions .

Changing image contrast makes the dark areas darker and the light areas lighter, improving image visibility and clarity. A hyperbolic tangent function is suggested for implementing contrast changes, since it can be scaled appropriately to enhance contrast, thus highlighting differences in pixel intensity more prominently .

You might also like