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 -------------------------------------------------------------------------------------------------------------------------------