Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a 5 1 2 5 1 2 image, stored in the variable image, you will break the image into smaller 8 8 chunks. Then

Given a 512512 image, stored in the variable image, you will break the image into smaller 88 chunks.
Then for each chunk, you will convert to the DCT basis, drop the frequencies with relatively small contribution,
then convert back to the standard basis and clip the resulting pixel values so that they lie between 0 and 255.
This image is given in gray scale, where each pixel varies from 0 to 255. To gauge which frequencies have a
small contribution, use a tolerance of 10% of the largest absolute value in each particular chunk after
converting it into the DCT basis.
The setup code provides the helper function create_dct_basis(n), which creates an nn matrix whose
columns make up the n-dimensional DCT basis.
To construct your solution, write a code snippet that:
defines the function compress_chunk(chunk) that takes as argument a "chunk" of the image, with
dimension 88, and returns the compressed "chunk".
make sure your compressed chunk returned from compress_chunk() contains only values between 0 and
255, as in the original image. You may find the function numpy. clip() useful.
use your function to construct the variable conpressed, which contains the compressed inage.
The setup code gives the following variable:
Your code snippet should define the following variable:
user_code.py
import numpy as np
import numpy-linalg as la
import matplotlib.pyplot as plt
plt.figure()
plt.imshow(image, cnap-'gray')
compressed - inage. )
## Add your code here
plt.figure()
plt.imshow(corpressed, cnap-'gray')
List of relevant illegal functions : linalg.inv(0, linalg.solve(0)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

e. What do you know about your ethnic background?

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago