Azzera filtri
Azzera filtri

error in dct transform for ycbcr color image

1 visualizzazione (ultimi 30 giorni)
when i perform dct2 for an image in ycbcr color space i get the following error.. i dunno wat i should define before takin transform..pls help me..
??? Error using ==> unknown Matrix dimensions must agree.
Error in ==> images\private\dct at 79 b = W .* fft(y);
Error in ==> dct2 at 50 b = dct(dct(arg1).').';

Risposta accettata

Walter Roberson
Walter Roberson il 4 Mar 2011
If you read the documentation for dct2 carefully, it all implies that the image must be 2D rather than 3D. That is, you cannot use dct2 on an RGB or YCrCb image, except perhaps color plane by color plane.
Notice how the example uses rgb2gray() on the sample image, which should correspond to the luminosity information in the Y channel. You could do something like locate the dct2 Y, Cr, and Cb separately, but figure out based upon the Y channel which locations to zero out, and zero those locations out in all 3 dct2 results. Then idct2 each back and splice together the results to get the new YCrCb matrix.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by