Normalize the size of images in a file

Source: Internet
Author: User
// 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.