C++ opencv Processing multiple images(批量處理圖像)

今天,需要對文件夾下的圖像進行批量處理,實現這部分功能。對文件夾下的圖像進行批量處理,實現數據集的製作。本文通過特殊處理,加強數據集的局部有效信息,便於深度學習更好的訓練識別。

  • Today, the need for the folder under the image batch processing, to achieve this part of the function.The image under the folder for batch processing, to achieve the production of data sets.In this paper, the local effective information of the data set is strengthened through special processing, so as to facilitate the deep learning and better training recognition.

CODE:

vector<Mat> ReadImage(cv::String pattern)
{
	vector<cv::String> fn;
	glob(pattern, fn, false);
	vector<Mat> images;
	size_t count = fn.size(); //number of png files in images folder
	for (size_t i = 0; i < count; i++)
	{
		images.emplace_back(cv::imread(fn[i]));
		cout << fn[i] << endl;
		//Rotate(imread(fn[i]),180.0, fn[i]);
		Pre_Table(imread(fn[i]),fn[i],5,5);
		//imshow("img", imread(fn[i]));
		waitKey(0);
	}
	return images;
}

CALL:

int _tmain(int argc, _TCHAR* argv[])
{

	#if 1 //批量處理圖像
	cv::String pattern = "./title_time/table/*.png";
	vector<Mat> img = ReadImage(pattern);
	#endif
}

 

 I hope I can help you,If you have any questions, please  comment on this blog or send me a private message. I will reply in my free time.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章