Opencv open an image in a folder

Source: Internet
Author: User
 // rgbsplit. CPP: defines the entry point for the console application. /// * ============================================ ==================================================== Name: open the image time in the folder: 2013.08 Description: sets num to control the number of opened images, to be regular =============================================================== */# include "stdafx. H "# include" CV. H "# include" highgui. H "char filename [100]; // defines a Global Array variable and stores the image name char windowname [100]; // defines a Global Array variable, save the window name iplimage * pscr; // a global image pointer at the top, pointing to the loop each time the image is loaded unsigned char * ReadImage (INT num ); // int main (INT argc, char * argv []) {ReadImage (5); // call the function return 0 ;} unsigned char * ReadImage (INT num) {for (INT I = 1; I <= num; I ++) // read the folder like {sprintf (filename ,". /test/mongod.jpg ", I); // read the photos in test to sprintf (windowname," window;d.jpg ", I) in filename ); // name the window pscr = cvloadimage (filename, 1); cvnamedwindow (windowname, cv_window_autosize); cvshowimage (windowname, pscr);} cvwaitkey (0 ); // destroy window and release memory cvreleaseimage (& pscr); cvdestroyallwindows (); Return 0 ;}

This Code sets the number of read images.

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.