Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

this will require a grayscale(1 channel) image, so we convert it to grayscale when loading:

Mat img = imread("my.tiff", CV_LOAD_IMAGE_GRAYSCALE);

since this is still uchar data (CV_8UC1) you 'll have to convert it to floating type:

Mat ff_in;
img.convertTo( ff_in, CV_32FC1, 1.0/255.0 );  // [0..1] range

run the dft:

Mat ff_out;
dct( ff_in, ff_out );

then, convert it back:

Mat ff_gray
ff_out.convertTo( ff_gray, CV_8UC1, 255.0 );
imshow("lalala",ff_out);

this will require a grayscale(1 channel) image, so we convert it to grayscale when loading:

Mat img = imread("my.tiff", CV_LOAD_IMAGE_GRAYSCALE);

since this is still uchar data (CV_8UC1) you 'll have to convert it to floating type:

Mat ff_in;
img.convertTo( ff_in, CV_32FC1, 1.0/255.0 );  // [0..1] range

run the dft:

Mat ff_out;
dct( dft( ff_in, ff_out );

then, convert it back:

Mat ff_gray
ff_out.convertTo( ff_gray, CV_8UC1, 255.0 );
imshow("lalala",ff_out);
imshow("lalala",ff_gray);

this will require a grayscale(1 channel) image, so we convert it to grayscale when loading:

Mat img = imread("my.tiff", CV_LOAD_IMAGE_GRAYSCALE);

since this is still uchar data (CV_8UC1) you 'll have to convert it to floating type:

Mat ff_in;
img.convertTo( ff_in, CV_32FC1, 1.0/255.0 );  // [0..1] range

run the dft:

Mat ff_out;
dft( ff_in, ff_out );

then, convert it back:

Mat ff_gray
ff_gray;
ff_out.convertTo( ff_gray, CV_8UC1, 255.0 );
imshow("lalala",ff_gray);