[VC + image] batch processing of images

Source: Internet
Author: User

Bytes -------------------------------------------------------------------------------------------------------------------------------

Batch processing of images

Skyseraph July 4th 2011 hqu

Email: zgzhaobo@gmail.com QQ: 452728574

Latest modified Date: July 4th 2011 hqu

Bytes -------------------------------------------------------------------------------------------------------------------------------

Batch process all the images in the folder. The grayscale color image is used as an example to addCode:

Int main (INT argc, char ** argv) {win32_find_dataa filedata; handle hfind; hfind = findfirstfilea (lpcstr) "IMGs /*. jpg ", & filedata); If (hfind = invalid_handle_value) {printf (" invalid file handle. getlasterror reports % d \ n ", getlasterror (); Return 0 ;}while (findnextfilea (hfind, & filedata) {cout <filedata. cfilename <Endl; string name ("IMGs/"); Name. append (filedata. cfilename); iplimage * src = cvloadi MAGE (name. c_str (); If (! SRC) {cout <"failed to load image" <Endl; // API // afxmessagebox ("failed to load image"); // MFC break ;} assert (SRC-> nchannels = 3); // process iplimage * srcgray = cvcreateimage (cvgetsize (SRC), ipl_depth_8u, 1); cvcvtcolor (SRC, srcgray, cv_bgr2gray ); // save name. append (".srcgray.jpg"); cvsaveimage (name. c_str (), srcgray); cvreleaseimage (& SRC); cvreleaseimage (& srcgray);} findclose (& hfind); Return 0 ;}

  

Effect (saving)

 

Bytes -------------------------------------------------------------------------------------------------------------------------------

Comparison reference:

How do I batch process an image file http://www.opencv.org.cn/forum/viewtopic.php for a folder? T = 12510

Traverses and reads all objects of the specified type in the specified folder.Http://blog.csdn.net/carson2005/archive/2011/03/31/6292726.aspx

Batch normalization of http://hi.baidu.com/yibobin/blog/item/c43e6801c7a10e111c95830d.html Images

How to Use VC ++ to batch process files in http://www.doc88.com/p-91973419874.html

Http://hi.baidu.com/%B9%C2%D6%DB%B5%F6%BF%CD/blog/item/d69f91c5e1f0ed029d163dc8.html

Opencv image format conversion and batch conversion using batch processing

Bytes -------------------------------------------------------------------------------------------------------------------------------

Author: skyseraph

Email/Gtalk: zgzhaobo@gmail.com QQ: 452728574

From: http://www.cnblogs.com/skyseraph/

The copyright of this article is shared by the author and the blog. You are welcome to repost this article, but you must keep this statement without the author's consent andArticleThe original text connection is clearly displayed on the page. Otherwise, the legal liability is retained.

 Bytes -------------------------------------------------------------------------------------------------------------------------------

 

  

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.