Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C Giver an NxMimage A. the required task is to compress tle ins, l to a reduced nnage e? tte saine diile iere NuM

in C

image text in transcribed

Giver an NxMimage A. the required task is to compress tle ins, "l to a reduced nnage e? tte saine diile iere NuM h1t with a smaller storage size. This type of reduction is usual y !nfn. cd as the pre es of in-e or v) le) mrx ession and video compression is now a standard procedure performed before we upload our images to social media sites, such as Pinterest Instagram, Facebook, or in uploading our video to Youtube, or before we send our fanciful video or image to a Eriend using our mobile phone, or over the internet. For this assignment, we will perform simple image compression using the discrete cosine transform (DCT) We are given the DCT matrix C, an initial quantization matrix Q. and the quantization parameter g Let a be the block size. We will fix n8 for this assignmens. We can assume for now that both N and M are powers of n. If it makes it any easier for you, you can further assume that N-M, but this is not always the case. The required compression is performed using matrix operations as follows (1) Divide the image into non-overlapping wxN sub blocks (2) For each block of the image, say X, we apply the DCT to get an output Y. This is performed using matrix multiplication and matrix transpose: Y-CXC:(U denotes transpose of matrix U, and UV denotes matrix multiplication of U and V) (3) Perform quantization on the resulting DCT coefficients (Y) to obtain the quantized result Z y roundY), 7, where Q is the quantization matrix. This is element-by-element division 4) For the purpose of this assignmen, we wil save the result of the quantization (Z) as our compressed image Essentially,each xn block in the original image is now represented using an nxn block of quantized DCT coefficients. For each sub block, save only the sequence of noa-zero values in the block as follows: ij, value. . . .y, value,-1 . Here,-1 indicates end of sub-block. (5) The compressed file (with sequence of (i, j-value) triples from each sub block) will be saved as a data structure with the following attributes: irnage dimensions (NxM) block size (nxnquantization parameter q percentage of zeros in Z, estimated size of Z in bytes (see below), the sequence of (ij, value,j, value, -I) for each block The original image is reconstructed from the compressed version by reversing the steps above: (1) Given the reconded sequence of (ij value,.. ij. value, -1) in the compressed file, reconstruct each sub-block in the Z matrix. Simply initialize the matrix to zeros, and use the (J, vale)triples to determine the non-zero values in the block (2) Given Z, perform the inverse quantization on each block to obtain Y as follows: Y-0, zy,7. This is elemens-by-element multiplication. (3) Apply the inverse DCT on Y to obtain the reconstracted X as follows X CTYC (4) Save the reconstructed image

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

Step: 3

blur-text-image

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

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions

Question

Recognize the power of service guarantees.

Answered: 1 week ago