网站开发的背景与环境,wordpress增加分类与标签,新河网房屋信息,买个网站域名要多少钱简介#xff1a; 同文件输入输出流一样#xff0c;使用stringstream可以批量读取图片#xff0c;处理后并进行保存。因为C中头文件 stringstream既可以从string读数据也可向string写数据#xff0c;利于其这个特点#xff0c;我们可以进行批量读取和批量保存工作。 参考程…简介 同文件输入输出流一样使用stringstream可以批量读取图片处理后并进行保存。因为C中头文件 stringstream既可以从string读数据也可向string写数据利于其这个特点我们可以进行批量读取和批量保存工作。 参考程序 /*批量读取图片进行均值滤波处理并保存至指定目录下*/
/*学习使用stringstream进行图片的批量读取与保存*/using namespace std;
using namespace cv;
int main()
{string imageFileName;std::stringstream Strm;int image_count 14;//图片数量std::cout 开始均值滤波处理........ endl;//便于控制台查看for (int i 0; i! image_count;i){std::cout 第i1张处理成功 endl;//便于控制台查看string filePath /home/ttwang/CameraCalibration/chess;//原图保存路径Strm i1;StrmimageFileName;filePathimageFileName;filePath.bmp;Mat imageSource imread(filePath);Mat newimage imageSource.clone();blur(imageSource,newimage,Size(7,7));//均值滤波处理
Strm.clear();filePath.clear();string SaveFilePath /home/ttwang/CameraCalibration/blur/p;//处理后的图片保存路径Strm i1;Strm imageFileName;SaveFilePath imageFileName;SaveFilePath _d.jpg;imwrite(SaveFilePath,newimage);}std::cout 保存结束 endl;return 0;
} 运行结果 (1)终端运行 2保存路径【从下图可以看到处理后的图片保存到了指定路径】 ps:处理效果就不显示了 转载于:https://www.cnblogs.com/ilym/p/8339935.html