int test_chars_recognisepr() {
			std::cout << "test_chars_recognise" << std::endl;

			cv::Mat src = cv::imread("resources/image/chars_recognise.jpg");
			CCharsRecognise cr;
			
			std::string plateLicense = "";
			int result = cr.charsRecognise(src, plateLicense);
			if (result == 0)
				std::cout << "charsRecognise: " << plateLicense << std::endl;
			return result;
		}
Example #2
0
void CBATCHDlg::OnBnClickedButtonRecognise()
{	
	CCharsRecognise plate;
	string res_str = "";
	
	int num_char = 0;
	for(vector<CString>::size_type v_i = 0; v_i < m_images.size(); ++v_i)
	{	
		res_str += m_images[v_i];
		res_str += " Result: ";

		vector<Mat> resultVec;
		string str = m_images[v_i].GetBuffer(0);
		
		int index1 = str.find_last_of("\\");
		int index2 = str.find_last_of(".");
		string name = str.substr(index1 + 1,index2 - index1 - 1);

		Mat src = imread(str, 1);
		string str_cr;
		int result = plate.charsRecognise(src, str_cr);
		if (result == 0)
		{
			res_str += str_cr;
			res_str += "\r\n";
			for(int j = 2; j < str_cr.size() && j < 8; ++j)
			{
				if(str_cr[j] == name[j]) ++num_char;
			}
		}
		else
		{
			res_str += "No Answer\r\n";
		}
	}
	res_str += "Char accuracy rate:";
	char buffer[50];
	sprintf(buffer,"%f\0",1.0 * num_char / (m_images.size() * 6));
	res_str += buffer;
	res_str += "\r\n";


	m_res = res_str.c_str();
	UpdateData(FALSE);

	
	CString filePath = this->m_savepath + "\\recognise.txt";
	std::ofstream resfile(filePath);
	resfile << res_str.c_str();
	resfile.close();
}
Example #3
0
int test_chars_recognise()
{
	cout << "test_chars_recognise" << endl;

	Mat src = imread("image/chars_recognise.jpg");

	CCharsRecognise cr;
	string charsRecognise = "";

	int result = cr.charsRecognise(src, charsRecognise);
	if (result == 0)
	{
		cout << "charsRecognise: " << charsRecognise << endl;
	}

	return result;
}