Hot answers tagged

19

The reason why you see Fourier transformation applied two times in the feature extraction process is that the features are based on a concept called cepstrum. Cepstrum is a play on the word spectrum - essentially the idea is to transform a signal to frequency domain by Fourier transform, and then perform another transform as if the frequency spectrum was a ...


19

The main difference between DCT and PCA (more precisely, representing a dataset in the basis formed by the eigenvectors of its correlation matrix - also known as the Karhunen Loeve Transform) is that the PCA must be defined with respect to a given dataset (from which the correlation matrix is estimated), while the DCT is "absolute" and is only defined by the ...


18

I've been reading about this and there are multiple ways to do it, using different size N. My Matlab is rusty, so here they are in Python (N is length of input signal x, k is arange(N) = $[0, 1, 2, ..., N-1]$): Type 2 DCT using 4N FFT and no shifts Signal [a, b, c, d] becomes [0, a, 0, b, 0, c, 0, d, 0, d, 0, c, 0, b, 0, a]. Then take the FFT to ...


13

Let me start from the beginning. The standard way of calculating cepstrum is following: $$C(x(t))=\mathcal{F}^{-1}[\log(\mathcal{F}[x(t)])] $$ In case of MFCC coefficients case is a bit different, but still similar. After pre-emphasis and windowing, you calculate the DFT of your signal and apply the filter bank of the overlapping triangular filters, ...


8

There are two parts to the answer. One has to do with the nature of sharp edges, the second has to do with the how imaging systems (lenses and the human eye) work. As @PeterK's example demonstrates artificial (human created) images tend to have large regions of one color with sharp transitions between the regions. This is similar to a square wave. But if ...


8

The Walsh-Hadamard transform requires a Hadamard matrix -- which has entries $\pm 1$ and whose rows are orthogonal vectors. A $n \times n$ Hadamard matrix is known to exist for $n = 2$. Larger Hadamard matrices can exist only if $n$ is a multiple of $4$, though it is not known if there is a Hadamard matrix for every multiple of $4$. However, there is a ...


8

I'm not sure what method the paper you referenced uses, but I have derived this before and here is what I ended up with: (Assuming $x(n)$ is the input) let $y(n) = \Bigl\lbrace \begin{array}{ll} x(n), & n=0,1,...,N-1\\ x(2N - 1 - n), & n=N,N+1,...,2N-1 \end{array}$ The DCT is then given by $C(k) = \mathrm{Re}\Bigl\lbrace e^{-j\pi \frac{k}{2N}} ...


7

What I'm planning to do is to apply edge detection to obtain the locations/indices of the pixels and then get their corresponding DCT Coefficient As others stated in the comment - any pixel in the given block is related to all co-efficient in the block and vice-versa. However, understand that Edge detection is a process of finding the gradient. Linear ...


7

Given a signal $x(t)$ of energy $\mathcal E$, suppose that $x(t)$ can be expressed as $\sum_i x_i\psi_i(t)$. If the $\psi_i(t)$ are a complete set of orthonormal signals, then $$\sum_i |x_i|^2 =\mathcal E$$ and one measure of energy compaction is the number of $x_i$ whose squared magnitude is larger than some fraction of $\mathcal E$, say $0.01\mathcal E$. ...


6

High frequencies correspond to rapid changes in pixel intensity over a small displacement (a few pixels) - most "natural" images have large features which change relatively slowly so most of the information is in the lower spatial frequency range. High frequencies tend to be mainly noise, sharp edges or very fine textured features. Note also that a similar ...


6

(Note: the paper pointed by hotpaw2's link is actually describing in more detail the algorthm I presented here) Consider a data window length of $N$ samples from $n=0$ to $n=N-1$. Let your original data window be $x_1[n]$, whose first sample is $x_{old} = x_1[0]$. Now your new data set is denoted as $x_2[n]$ whose samples are actually one sample left ...


5

To give you an upfront answer your question you want to determine the $pixel-values$ from $DCT-Coefficients$ probably there is nothing on earth better than doing IDCT itself! However, leaving aside some vagueness i can re-phrase your question: If i have an algorithm x - that is defined to work on Pixels, here is what i do: DCT-Coeffs -> IDCT -> pixels ...


5

I am not sure if Jsteg, Outguess or F5 make already use of this, but in theory you could use the APP segment to hide information. Also the Quantization Table (DQT) could offer some limited space. You will have to study the effects of hiding data in there. Changing the DCT coefficients seems to be the most sensible thing to do in my opinion.


5

Given $\{x_n, 0 \leq n \leq N - 1\}$, the conventional DFT is defined as $$X_k = \sum_n x_n e^{-j2\pi kn/N}$$ The Parseval theorem gives $$\sum_{n=0}^{N-1} |x_n|^2 = \frac{1}{N}\sum_{k=0}^{N-1} |X_k|^2$$ The DFT in your link is called Normalized DFT (NDFT): $$Y_k = \frac{1}{\sqrt{N}} X_k = \frac{1}{\sqrt{N}} \sum_n x_n e^{-j2\pi kn/N}$$ that $$\sum_{n=...


4

If $g(x)= f(N-1-x)$ then $$\begin{aligned} (\operatorname{DCT}\:g)(u) =& c(u)\cdot\sum_{x=0}^{N-1}g(x)\cdot\cos\bigl((2x+1)u\cdot\tfrac\pi{2N}\bigr) \\=& c(u)\cdot\sum_{x=0}^{N-1}f(N-1-x) \cdot\cos\bigl((2N-2N+1+2x)u\cdot\tfrac\pi{2N}\bigr) \\=& c(u)\cdot\sum_{(N-1-x)=(N-1)}^{0}f(N-1-x) \cdot\cos\Bigl(\bigl(2N-1-2(...


4

One can get the presence of an edge in a given DCT block. It is easier to compute the First order and second order moments from the given DCT coefficients. Variance in a small region is an approximation of the gradient at the center (x0,y0) of the block. The Variance in a block can be estimated from the DCT coefficients as summation of squares of the AC ...


4

Low-pass filtering is based on the assumption that "natural" images have more energy in the low-frequency coefficients than in the high frequency coefficients ; while noise will affect equally all coefficients. Thus, removing the high frequency coefficients will comparatively eliminate more noise than signal. The problem is that there are "legit" high-...


4

Whenever you do the inverse DCT transform to get back to the image you are going to have a floating point result. That is unavoidable. Assuming the image format you are using requires integer values (not an image guy, so I'm not sure if there are any formats that allow floating point values- probably not) then rounding is unavoidable. Rounding means ...


4

Each DCT output bin is a (weighted) correlation against a cosine function of a certain frequency. A negative value would represent a negative correlation, e.g. something in the image data is of the opposite phase to that cosine (e.g. maybe dark when the cosine is 1, and light when the cosine is -1, instead of vice-versa for a positive correlation).


4

You are right! When it comes to quantization, bit allocation or issues like that scanning in zig zag manner seems to be most efficient. As you said, (and I emphasize) in Natural Signals, lower frequency coefficients contain most of the energy. In a DCT matrix, as you go along a row the frequency is increasing in the first dimension and as you go along a ...


4

Alright, after some days of staring at this problem I hope I can provide a bit of guidance to the next poor soul. Yes the scaling is different. Compared to scipy.fftpack.dct the DC term is $\frac{1}{2}$ and the other terms $\frac{\sqrt{2}}{2}$. But apparently it all nicely cancels out in the inverse transform. The inverse input order is exactly as they come ...


4

The algorithm for which you may be looking is called a "sliding DFT". For a small number of result bins, that number of "sliding Goertzel" filters can also be used. Here's one online description: https://www.dsprelated.com/showarticle/776.php of how to implement a sliding DFT. Basically, for each new sample, you add a new twiddle-multiplied vector to the ...


4

Not really, as the transform is real. However, one could interpret the sign as a poor man's phase, being "quantized" or restricted to values $0$ or $\pi$. In other words, $1 = 1.e^{0.\imath}$ and $-1 = 1.e^{\pi.\imath}$. [EDIT] There are some instances where people use the sign of DCT or (real) wavelet coefficients, for subpixel image registration or ...


4

A DCT is equivalent to a DFT of real data that is doubled and mirrored, thus rendering it symmetric. The DFT of any symmetric real signal has a phase of zero (its all cosines, no antisymmetric sine components).


3

As far as I can see, there are two little mistakes. First of all, you should use dct2() instead of dct(). And second, you shouldn't use the 'transpose' function because you want the DCT matrix not only transposed but also conjugated. So you should do the following: $$\tt{T=dctmtx(4); DCTB = T*B*T'}$$ And this should equal $\tt dct2(B)$. EDIT: As correctly ...


3

Regarding exceptions: Scanned monochrome documents, especially drawings/engravings/comics/technical blueprints, can have high frequency components, due to the sharp edges, fill patterns and use of cross-hatching.


3

In Huffman coding frequency refers to the number of times a particular sequence of discrete source symbols has appeared in the input. It is not the same concept as frequency in the continuous space such as sound frequency. As such, it has nothing to do with psychoacoustics or the cochlea. We use fewer bits for the higher frequency source symbols because ...


3

Block matching will only work well if the pixel offset is (close to) a multiple of the block size, in both dimensional axises. Odds against that might be (8*8-1):1 or (16*16-1):1.


3

If you are encoding the JPEG image, and know exactly which JPEG decoder or decoding algorithm will be used, any change in the pixel values can be determined. Thus it might be possible to encode information in sufficiently spaced pixel values by using an iterative approach to modifying their value (which may involve modifying nearby pixels as well).


3

Perhaps you can detect the presence of a sharp change in color/brightness by detecting high frequency components in the Y block. If there are non-zero coefficients in the high frequency end of the DCT block, that indicates a sharp edge. You won't know its exact position in the block without doing the transform, but you can know if there is a sharp line/dot.


Only top voted, non community-wiki answers of a minimum length are eligible