0
votes

As a simple 8X8 matrix can be encrypted by performing DCT over it and the original matrix can be easily decrypted by applying IDCT over the DCT matrix; I am trying to apply DCT on every block of an image by 'block processing' (block size 8 ).

After performing the DCT on every block of the image, I'll be left with a very big matrix with DCT values. Now I want to write an image with the DCT values(representing an encrypted image). The problem is that the grayscale image can only store values from 0-255.

How is it possible to store the the DCT values in an image?

I AM NOT TRYING TO DO A COMPLETE JPEG COMPRESSION. Just the DCT and IDCT over an image in java.

1
I don't get the Problem. After DCT you should end up with just as many values as you had grey pixels.Fildor
Problem is not about the number of pixels but its about the value of the pixels. Suppose the value of a pixel is 372, how can I store it in a grayscale image?Rohit S
It would be much better if you posted an minimal reproducible example(stackoverflow.com/help/mcve] but why not use a 16 bit image to store the values?kkuilla
Can't use 16b because am dealing with grayscale values. That means I have work within the range of 0-255Rohit S
Can you post the formula you implemented? I' ll have to look it up. Not sure if 8 bit are sufficient to store coefficients.Fildor

1 Answers

1
votes

I hate to disappoint you here but running the DCT on grayscale data negatively compresses. It takes roughly twice as much data to represent an 8x8 block after using the DCT.

You're not going to compress an image with the DCT alone. It's the other JPEG processes (quantization, huffman coding, entropy coding) with the DCT that compress.