sadaf2605
sadaf2605

Reputation: 7540

DCT of an image in octave

Acording to Octave documentation for dct2, dct2 (x) Computes the 2-D discrete cosine transform of matrix x but when I have tried this following code I am getting an error, what can I possibly doing wrong?

A= imread('img.jpg')
[m,n]=size(A)
B=dct2(A)

it returns an error that:

ERROR: 'dct2' undefined near line 4 column 3

I have tried checking whether A is a matrix or not, and its a matrix, so where is the bug? I am using OCtave 3.2.4 on windows.

Upvotes: 3

Views: 4819

Answers (1)

Octave is not finding the function definition. You must first install the signal package, you can download it from http://octave.sourceforge.net/signal/index.html and, in the same folder of the file, prompt octave and call:

pkg install signal-1.2.0.tar.gz 

Or, as suggested by @carandraug in the comments, since Octave 3.4 you can download and install packages automatically by typing:

pkg install -forge signal

On permission errors try prompting with sudo octave and after installed add:

pkg load signal

before the use of dct2 function.

Upvotes: 6

Related Questions