// Shiyan. cpp: defines the entry point for the console application.
//
# Include "stdlib. H" // system needs to call this
# 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 starts normalization! \ N ";
While (SRC)
{
Sprintf (winname, "mongod.bmp", image_id );
Imageresize = cvcreateimage (cvsize (60, 60), ipl_depth_8u, 3); // create a header and allocate data
Cvresize (SRC, imageresize, cv_inter_linear); // function cvresize re-adjusts the image SRC (or its ROI) so that it precisely matches the destination DST (or its 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 normalized! \ N ";
System ("pause ");
}Running Effect and Result
Normalize the size of a file Image