Discrete Cosine Transform help

2 views (last 30 days)
Seth
Seth on 14 Dec 2014
Commented: Image Analyst on 15 Dec 2014
  1. Break an image-pixel array down into smaller blocks, e.g. 8 × 8 (or 16 × 16) pixels,
  2. perform a discrete cosine transform (dct) on these smaller blocks,
  3. apply a mask, consisting of an 8 × 8 array of zeros and ones, using array multiplication on the above dct block in order to eliminate certain high-frequency components,
  4. use the inverse discrete cosine transform (idct) to reconstruct 8 × 8 image blocks, and
  5. reassemble the blocks into a new image.Create your own function based on this script that will use 8×8 blocks, and will acceptthe name and type of an image together with a matrix representing the mask as input arguments2. I have looked at the ex from mathworks but it hasn't helped much. Any help would be greatly appreciated
  2 Comments
Azzi Abdelmalek
Azzi Abdelmalek on 14 Dec 2014
And what is your question?
Seth
Seth on 15 Dec 2014
I do not even know where to start. #5 is where the prompt is

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 15 Dec 2014
To reassemble a matrix from two matrices, just stitch them together:
wideMatrix = [m1, m2];
tallMatrix = [m1; m2];
Put that into a loop where you make sure you change m1 and m2 so that they're the appropriate matrices for that location in the larger matrix you're assembling.
  2 Comments
Image Analyst
Image Analyst on 15 Dec 2014
Seth's "Answer" moved here since it's a question to me, not an answer to his original question above:
How would you put the matrices in a loop to where I am changing m1 and m2. Sorry I am new to image processing
Image Analyst
Image Analyst on 15 Dec 2014
Let's say your blocks are in a cell array. Then you can do
for col = 1 : columns
% Stitch the blocks together vertically.
for row = 1 : rows
thisBlock = cellArray{row, column};
if row == 1
thisVerticalBand = thisBlock;
else
thisVerticalBand = [thisRow; thisBlock];
end
end
% Now we have a vertical band of the image.
% Append it horizontally onto the prior bands.
if col == 1
outputImage = thisVerticalBand;
else
outputImage = [outputImage, thisVerticalBand];
end
end
Or something like that. I hope you already know how to use the debugger to step through code. This is just untested, off the top of my head.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!