标签:style io ar strong for 文件 数据 sp div
// SHIYAN.cpp : Defines the entry point for the console application.
//
#include"stdlib.h" //system需要调用这个
#include "stdafx.h"
#include "stdio.h"
#include "cv.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int image_id = 1;
char filename[256];
char filename2[256];
char winname[256];
IplImage *image=0,*imageresize=0;
sprintf(filename , "..\\%d.bmp" , image_id );
IplImage* src = cvLoadImage(filename);
cout<<"\n 开始归一化! \n";
while(src)
{
sprintf(winname , "%d.bmp" , image_id );
imageresize=cvCreateImage(cvSize(60,60),IPL_DEPTH_8U,3); //创建头并分配数据
cvResize(src,imageresize,CV_INTER_LINEAR); //函数cvResize 重新调整图像src(或它的ROI),使它精确匹配目标dst(或其ROI)。
sprintf(filename2 , "%d.bmp" , image_id );
cvSaveImage(filename2, imageresize);
cvReleaseImage(&imageresize);
cvReleaseImage(&src);
image_id++;
sprintf(filename , "..\\%d.bmp" , image_id );
src= cvLoadImage(filename);
}
cout<<"\n 归一化完毕! \n";
system("PAUSE");
}
运行效果及结果
对文件下图像进行尺寸归一化
标签:style io ar strong for 文件 数据 sp div
原文地址:http://www.cnblogs.com/taopanpan/p/4000853.html