Opencvあるpathの下のピクチャサイズを変更する



#include //project->settings->general->Use MFC in a shared DLL
#include "windows.h"
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include "cvaux.h"
#include "string"
#include "vector"
#include "iostream"

using namespace  std;
void FindAllFile(string _path, vector& filenames)
{
	CString path = _path.c_str();
	CFileFind finder;
	BOOL working = finder.FindFile(path + "\\*.*");
	while (working)
	{
		working = finder.FindNextFile();
		if (finder.IsDots())
			continue;
		if (finder.IsDirectory())
		{
			//         
			//CString::GetBuffer(0)=>string
			FindAllFile(finder.GetFilePath().GetBuffer(0), filenames);
		} 
		else 
		{
			string filename = finder.GetFileName();
			filenames.push_back(filename);
		}
	}
}

int main()
{
	vector filenames;
	string filePath = "C:\\Users\\careyjiang\\Desktop\\iphoneLargePicEnglish";
	FindAllFile(filePath, filenames);
	for (vector::iterator itr = filenames.begin(); itr != filenames.end();itr++)
	{
// 		size_t potPose = itr->find_last_of('.');		//   
// 		if (itr->substr(potPose, string::npos) == ".jpg")/// jpg   
// 		{
// 			IplImage* curImage;
// 			string jpgPath = filePath+ "\\" + (*itr);
// 			curImage = cvLoadImage( jpgPath.c_str(),1);
// 			string bmpPath =filePath+ "\\"  + itr->substr(0,potPose) + ".bmp" ;
// 			cvSaveImage(bmpPath.c_str(),curImage);
// 			cvReleaseImage(&curImage);
// 		}		
		size_t potPose = itr->find_last_of('.');		//   
		if (itr->substr(potPose, string::npos) == ".bmp")/// jpg   
		{
			IplImage* curImage;
			string jpgPath = filePath+ "\\" + (*itr);
			curImage = cvLoadImage( jpgPath.c_str(),CV_LOAD_IMAGE_COLOR);		
			float scale = 7.5/8;
			IplImage*  imageresize=cvCreateImage(cvSize(280,170),IPL_DEPTH_8U,3);  
			cvResize(curImage,imageresize,CV_INTER_LINEAR);  
			string smallPath =filePath+ "\\small\\"+"small"  + *itr;
			cvSaveImage(smallPath.c_str(),imageresize);
			cvReleaseImage(&curImage);
			cvReleaseImage(&imageresize);
		}

	}

}