神经网络识别数字
- opencv3.1.0+vs2013
- 只允许单张图片识别
- 训练集为数字样本0-9,每类样本内有50个数字图片。
#include<windows.h>
#include <opencv2/opencv.hpp>
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/ml/ml.hpp"
using namespace cv;
using namespace std;
using namespace ml;
char* WcharToChar(const wchar_t* wp)
{
char *m_char;
int len = WideCharToMultiByte(CP_ACP, 0, wp, wcslen(wp), NULL, 0, NULL, NULL);
m_char = new char[len + 1];
WideCharToMultiByte(CP_ACP, 0, wp, wcslen(wp), m_char, len, NULL, NULL);
m_char[len] = '\0';
return m_char;
}
wchar_t* CharToWchar(const char* c)
{
wchar_t *m_wchar;
int len = MultiByteToWideChar(CP_ACP, 0, c, strlen(c), NULL, 0);
m_wchar = new wchar_t[len + 1];
MultiByteToWideChar(CP_ACP, 0, c, strlen(c), m_wchar, len);
m_wchar[len] = '\0';
return m_wchar;
}
wchar_t* StringToWchar(const string& s)
{