#include "cxcore.h" #include <stdio.h> #define FLAG 0 #define ERRMODE 0 void cvResizeDCT(CvMat *input_array,CvMat * output_array) { CvMat * temp_array=0; CV_FUNCNAME("cvResizeDCT"); /*#define CV_FUNCNAME( Name ) static char cvFuncName[] = Name*/ //定义了这个函数的名字,其实就是一个字符数组 __BEGIN__; if (!CV_IS_MAT(input_array) || !CV_IS_MAT(output_array)) { CV_ERROR(CV_StsBadArg,"Invaild matrices!"); } CV_ASSERT(input_array ->rows ==1 && output_array ->rows ==1); CV_CALL(temp_array = cvCreateMat(input_array ->rows,MAX(input_array->cols, output_array->cols),input_array->type)); if (output_array->cols > input_array->cols) { CV_CALL(cvZero(temp_array)); } temp_array->cols = input_array->cols; CV_CALL( cvDCT( input_array, temp_array, CV_DXT_FORWARD ));//离散馀弦变换 temp_array->cols = output_array->cols; CV_CALL( cvDCT( temp_array, output_array, CV_DXT_INVERSE )); CV_CALL( cvScale( output_array, output_array, 1./sqrt((double)input_array->cols*output_array->cols), 0 )); __END__; } int main(void) { CvMat *src = /blog.armyourlife.info/cvCreateMat(1,512,CV_32F); #if FLAG CvMat *dst = cvCreateMat(1,256,CV_32F); #else CvMat *dst=0; #endif cvSet(src,cvRealScalar(1.),0); #if ERRMODE cvSetErrMode(CV_ErrModeSilent); #endif cvResizeDCT(src,dst); if (cvGetErrStatus()<0) { printf("Some Error Occured!"); } else { printf("Everything is OK!\n"); } return 0; }
www.diy567.com累了,去上面休息一下下,QQ空间,美文,非主流,网络日记,搞笑短信,祝福短信,热门短信,有意思啊