Questions tagged [dct]

Discrete Cosine Transform (DCT).

A discrete cosine transform (DCT) expresses a sequence of finitely many data points in terms of a sum of cosine functions oscillating at different frequencies. DCT's are important to numerous applications in science and engineering, from lossy compression of audio (e.g. MP3) and images (e.g. JPEG) (where small high-frequency components can be discarded), to spectral methods for the numerical solution of partial differential equations.

More information on Wikipedia: Discrete cosine transform .

277 questions
5
votes
1 answer

Changing hash size in ImageHash Python library

I'm using ImageHash library to generate the perceptual hash of an image. The library claims to be able to generate hashes of different size (64, 128, 256), but I can't figure how to get a 128 hash. The hash size is determined by the image size when…
Hyperion
  • 2,515
  • 11
  • 37
  • 59
5
votes
1 answer

DCT Compression - Block Size, Choosing Coefficients

I'm trying to understand the effect of the Block Size and best strategy of choosing the Coefficients in DCT compression. Basically I want to ask what I wrote here: Video Compression: What is discrete cosine transform? Lets assume the most primitive…
Royi
  • 4,640
  • 6
  • 46
  • 64
5
votes
1 answer

Discrete cosine transform (DCT) of an image

I work on a function in Matlab that calculates the DCT (discrete cosine transform) of an image. I don't know what is not working in my code, but I got an output image with the same number. I want to use this formula for my DCT. Any ideas please. …
user2827482
  • 199
  • 1
  • 2
  • 9
5
votes
1 answer

Scipy's fftpack dct and idct

Let say you use the dct function, then do no manipulation of the data and use the invert transform; wouldn't the inverted data be the same as the pre-transformed data? Why the floating point issue? Is it a reported issue or is it a normal…
macrocosme
  • 473
  • 7
  • 24
4
votes
2 answers

How does this implementation of 1D IDCT work?

I have an implementation of a Inverse Discrete Cosine Transform and I'm trying to figure out how they got to this code. So far, I've figured out that this is probably an optimized implementation of the Cooley-Tukey radix-2 Decimation-in-time for a…
Tony The Lion
  • 61,704
  • 67
  • 242
  • 415
4
votes
0 answers

Extract Dct coefficient from images python?

I have seen the post describing how DCT coefficients can be extracted and visualized in C++. I have seen the python API. Where there is a function bob.ip.base.DCTFeatures(). bob.ip.base.DCTFeatures (coefficients, block_size, [block_overlap],…
Arsenal Fanatic
  • 3,663
  • 6
  • 38
  • 53
4
votes
1 answer

2D Discrete Cosine Transform using 1D DCT

I am trying to implement the 2D Discrete Cosine Transform to an image by using 1D DCT operations. My output is incorrect if I compare it to the dct2 MATLAB function. I don't understand what went wrong in my code and where it's happening. If someone…
bumpk_sync
  • 95
  • 2
  • 6
4
votes
1 answer

Overlapping sliding window over an image using blockproc or im2col?

I have to apply dct2 to small windows of my image, preferably by using an overlapping window. I have found out that there are two functions in Matlab that can make this possible blockproc and im2col. I am having trouble understanding either and…
StuckInPhDNoMore
  • 2,507
  • 4
  • 41
  • 73
4
votes
1 answer

How to convert YUV422 (sub sampling) to YUV?

I'm coding a video codec using the JPEG compression technic for each frame. Until here I've already coded YUV, DCT and quantized DCT (encoding and decoding). I already have coded YUV422 encoding too but I don't understand how to do the inverse…
user1364743
  • 5,283
  • 6
  • 51
  • 90
4
votes
2 answers

How to get dct of an image in python using opencv

I've been trying to figure out a way of getting a DCT of image. After getting the image and doing a bunch of filtering, I want to calculate DCT. Following is the code sniplet: imgcv1 = cv2.split(imgcv)[0] cv2.boxFilter(imgcv1, 0, (7,7), imgcv1,…
Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124
4
votes
0 answers

DCT method implementation for image steganography

I need to implement a program that embeds text message inside an image (PNG or BMP it doesn't matter) using DCT matrix for hiding message. I read some articles but most of them very complex. Here is the basic steps: Break an image into 8x8 blocks…
Pavel Shchegolevatykh
  • 2,568
  • 5
  • 29
  • 32
4
votes
2 answers

How to calculate Discrete Cosine Transform (DCT) in PHP?

What I'd like here is a working, optimized version of my current code. While my function does return an array with actual results, I don't know if they are correct (I'm not a mathematics guru and I don't know Java code to compare my results against…
skibulk
  • 3,088
  • 1
  • 34
  • 42
4
votes
1 answer

Concise implementation of DCT, DFT in C#?

I have been looking at various implementations of Discrete Cosine Transforms and Discrete Fourier Transforms implemented in C#, yet none is as concise as I would like. A bonus point would be, code derived from a larger open source project (i.e.…
Lorenz Lo Sauer
  • 23,698
  • 16
  • 85
  • 87
4
votes
2 answers

Need help on BMP to JPEG conversion

I'm writing a C++ program to convert a BMP image into a JPEG. Here's the basic algorithm I'm trying to follow: Convert RGB color space to Y,Cb,Cr.. Down sample Cb and Cr by 2 (that means for each square block of 2*2 there is 4 different Y value but…
Umang
3
votes
1 answer

Decompression stops inbetween and output file filled with zeros(BLACK PIXELS)?

I am trying to apply DCT(discrete cosine transformation) compression on a bmp(bitmap) file. I have a c file which i am running in Turbo C++. This is not actually compressing but i was trying to implement the DCT and IDCT. The code is as…
Som Pra
  • 453
  • 3
  • 13
1
2
3
18 19