资源简介
在VS2013平台上,使用OpenCV3.0对34种字符进行识别判断。
文当中包含 34种字符 样本,每种样本各有50个
代码片段和文件信息
#include
#include
#include
#include
using namespace cv;
using namespace std;
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)
{
const char* p = s.c_str();
return CharToWchar(p);
}
int main()
{
const string fileform = “*.png“;
const string perfileReadPath = “charSamples“;
const int sample_mun_perclass = 40;//训练字符每类数量
const int class_mun = 10 + 26;//训练字符类数 0-9 A-Z 除了I、O
const int image_cols = 8;
const int image_rows = 16;
string fileReadName
fileReadPath;
char temp[256];
//float trainingData[class_mun*sample_mun_perclass][image_rows*image_cols] = { { 0 } };//每一行一个训练样本
//float labels[class_mun*sample_mun_perclass][class_mun] = { { 0 } };//训练样本标签
//for (int i = 0; i <= class_mun - 1; i++)//不同类
//{
// //读取每个类文件夹下所有图像
// int j = 0;//每一类读取图像个数计数
// if (i <= 9)//0-9
// {
// sprintf_s(temp “%d“ i);
// //printf(“%d\n“ i);
// }
// else//A-Z
// {
// sprintf_s(temp “%c“ i + 55);
// //printf(“%c\n“ i+55);
// }
// fileReadPath = perfileReadPath + “/“ + temp + “/“ + fileform;
// cout << “文件夹“ << temp << endl;
// HANDLE hFile;
// LPCTSTR lpFileName = StringToWchar(fileReadPath);//指定搜索目录和文件类型,如搜索d盘的音频文件可以是“D:\\*.mp3“
// WIN32_FIND_DATA pNextInfo; //搜索得到的文件信息将储存在pNextInfo中;
// hFile = FindFirstFile(lpFileName &pNextInfo);//请注意是 &pNextInfo 不是 pNextInfo;
// if (hFile == INVALID_HANDLE_VALUE)
// {
// continue;//搜索失败
// }
// //do-while循环读取
// do
// {
// if (pNextInfo.cFileName[0] == ‘.‘)//过滤.和..
// continue;
// j++;//读取一张图
// //wcout< // //printf(“%s\n“WcharToChar(pNextInfo.cFileName));
// //对读入的图片进行处理
// Mat srcImage = imread(perfileReadPath + “/“ + temp + “/“ + WcharToChar(pNextInfo.cFileName) CV_LOAD_IMAGE_GRAYSCALE);
// Mat resizeImage;
// Mat trainImage;
// Mat result;
// resize(srcImage resizeImage Size(image_cols image_rows) (0 0) (0 0) CV_INTER_AREA);//使用象素关系重采样。当图像缩小时候,该方法可以避免波纹出现
// threshold(resizeImage trainImage 0 255 CV_THRESH_BINARY | CV_THRESH_OTSU);
// for (int k = 0; k // {
// trainingData[i*sample_mun_perclass + (j - 1)][k] = (float)trainImage.data[k];
// //trainingData[i*sample_mun_perclass+(j-1)][k] = (float)trainImage.at((int)k/8(int)k%8);//(fl
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-01-23 15:47 ConsoleApplication1\
目录 0 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\
文件 223273 2016-05-12 17:14 ConsoleApplication1\ConsoleApplication1\22.jpg
文件 243619 2016-05-12 17:23 ConsoleApplication1\ConsoleApplication1\232.jpg
文件 169644 2017-11-24 18:59 ConsoleApplication1\ConsoleApplication1\34zimu.xm
文件 8072 2017-11-06 15:21 ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.vcxproj
文件 944 2016-05-12 13:18 ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.vcxproj.filters
目录 0 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\
目录 0 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.6116B2D9.tlog\
文件 29152 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.6116B2D9.tlog\CL.read.1.tlog
文件 620 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.6116B2D9.tlog\CL.write.1.tlog
文件 180 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.6116B2D9.tlog\ConsoleApplication1.lastbuildstate
文件 698 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.6116B2D9.tlog\cl.command.1.tlog
文件 1368 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.6116B2D9.tlog\li
文件 2626 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.6116B2D9.tlog\li
文件 594 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.6116B2D9.tlog\li
文件 2869 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleApplication1.log
文件 234569 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\anncpp.obj
文件 977920 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\vc120.idb
文件 1036288 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\Debug\vc120.pdb
文件 75928 2016-05-12 17:02 ConsoleApplication1\ConsoleApplication1\QQ图片20160512170300.png
文件 6570 2017-12-03 11:31 ConsoleApplication1\ConsoleApplication1\anncpp.cpp
目录 0 2016-05-12 13:12 ConsoleApplication1\ConsoleApplication1\charSamples\
目录 0 2016-05-12 13:07 ConsoleApplication1\ConsoleApplication1\charSamples\0\
文件 376 2013-11-07 08:35 ConsoleApplication1\ConsoleApplication1\charSamples\0\10_0.792674_gray_14967_5950_step5_recog_4_0_0.890217_0.705652.png
文件 413 2013-11-10 08:12 ConsoleApplication1\ConsoleApplication1\charSamples\0\11_0.971377_gray_20751_8531_step5_recog_4_0_0.996446_0.967925.png
文件 413 2013-11-09 08:47 ConsoleApplication1\ConsoleApplication1\charSamples\0\12_0.953826_gray_975_407_step5_recog_5_0_0.987086_0.941508.png
文件 376 2013-11-06 07:31 ConsoleApplication1\ConsoleApplication1\charSamples\0\13_0.924615_gray_5457_2092_step5_recog_6_0_0.987233_0.912810.png
文件 413 2013-11-07 10:29 ConsoleApplication1\ConsoleApplication1\charSamples\0\14_0.749970_gray_17934_7138_step5_recog_4_0_0.787806_0.590831.png
文件 398 2013-11-07 01:38 ConsoleApplication1\ConsoleApplication1\charSamples\0\15_0.877296_gray_8040_2899_step5_recog_4_0_0.969689_0.850704.png
文件 390 2013-11-09 16:11 ConsoleApplication1\ConsoleApplication1\charSamples\0\16_0.949891_gray_12542_5631_step5_recog_5_0_0.989526_0.939942.png
............此处省略1840个文件信息
相关资源
- StarUML 3.0.2 完美破解包
- OpenCV ANN 神经网络 数字识别
- 基于opencv的性别识别
- OpenCV4.0+contrib_installVS2017
- 利用VS编写的基于Opencv大米计数程序
- opencv 比赛对阵图自动生成
- ippicv_2017u3_lnx_intel64_general_20170822.tar
- Spring Boot 集成PageOffice4.3.0.2
- opencv识别数字
- SAP.NET CONNECTOR 3.0.18 FOR X64
- PCIe规范各版本合集1.0a、2.0、2.1、3.
- 3GPP TS 36.521-1 version 14.3.0 Release 14(2
- USB3.0驱动安装在winpe下运行
- openCV for iOS
- 眼底图像拼接
- OPENCV实现ORB/SURF/SIFT + RANSAC 图像自动拼
- ippicv_2017u3_lnx_intel64_general_20180518.tgz
- LearningOpenCV中文版-于仕琪书源码.zip
- zabbix-3.0.4.tar.gz
- qtOpenCVTools v1.7.0.rar
- MonoDevelop-3.0.6
- emqttd-windows7-v2.3.0.zip
- Firebird 3.0.2 及其管理工具 IBExpert2017
- mingw64编译好的OpenCV3.4.10
- OpenCV 4.2.0 && Qt5.14.1 编译好的库
- 全能电子地图器3.0 破解版
-
OpenCV的haarcascades 各种分类器xm
l文件 - OpenCV计算机视觉编程攻略 第三版
- opencv-4.1.0样例图片和视频.zip
- OpenCv3.3 32位版本
评论
共有 条评论