資源簡介
數碼管數別字識,使用KNN算法,OpenCV+VC2013
代碼片段和文件信息
#include?“lineidentify.h“
bool?IsAllWhite(Mat?inputmat)
{
if?(inputmat.rows?*?inputmat.cols?==?cvCountNonZero(&(IplImage)inputmat))
return?true;
else
return?false;
}
bool?IsAllBlack(Mat?inputmat)
{
if?(cvCountNonZero(&(IplImage)inputmat)?==?0)
return?true;
else
return?false;
}
/************???穿線法識別數碼管數字??**********/
bool?Iswhite(Mat?inputmat?int?row_start?int?row_end?int?col_start?int?col_end)
{
int?white_num?=?0;
for?(int?i?=?row_start;?i?<=?row_end;?i++)
{
for?(int?j?=?col_start;?j?<=?col_end;?j++)
{
if?(inputmat.at(i?j)?==?255)
white_num++;
//cout?< }
}
if?(white_num?>?5)
return?true;
else
return?false;
}
int?TubeIdentification(Mat?inputmat)?//?穿線法判斷數碼管a、b、c、d、e、f、g、
{
int?tube?=?0;
int?tubo_roi[7][4]?=
{
{?inputmat.rows?*?0?/?3?inputmat.rows?*?1?/?3?inputmat.cols?*?1?/?2?inputmat.cols?*?1?/?2?}?//?a
{?inputmat.rows?*?1?/?3?inputmat.rows?*?1?/?3?inputmat.cols?*?2?/?3?inputmat.cols?-?1?????}?//?b
{?inputmat.rows?*?2?/?3?inputmat.rows?*?2?/?3?inputmat.cols?*?2?/?3?inputmat.cols?-?1?????}?//?c
{?inputmat.rows?*?2?/?3?inputmat.rows?-?1?????inputmat.cols?*?1?/?2?inputmat.cols?*?1?/?2?}?//?d
{?inputmat.rows?*?2?/?3?inputmat.rows?*?2?/?3?inputmat.cols?*?0?/?3?inputmat.cols?*?1?/?3?}?//?e
{?inputmat.rows?*?1?/?3?inputmat.rows?*?1?/?3?inputmat.cols?*?0?/?3?inputmat.cols?*?1?/?3?}?//?f
{?inputmat.rows?*?1?/?3?inputmat.rows?*?2?/?3?inputmat.cols?*?1?/?2?inputmat.cols?*?1?/?2?}?//?g
};
if?(inputmat.rows?/?inputmat.cols?>?3)???//?1?is?specialwhich?is?much?narrower?than?others
{
tube?=?6;
}
else
{
for?(int?i?=?0;?i?7;?i++)
{
if?(Iswhite(inputmat?tubo_roi[i][0]??tubo_roi[i][1]?tubo_roi[i][2]?tubo_roi[i][3]))
tube?=?tube?+?(int)pow(2?i);
}
}
switch?(tube)
{
case??63:?return?0;??break;
case???6:?return?1;??break;
case??91:?return?2;??break;
case??79:?return?3;??break;
case?102:?return?4;??break;
case?109:?return?5;??break;
case?125:?return?6;??break;
case???7:?return?7;??break;
case?127:?return?8;??break;
case?111:?return?9;??break;
default:?return?-1;
}
}
//char?trainfile[10];
//void?TraindataRead(Mat*?traindata?int?traindatanum)
//{
// for?(int?i?=?0;?i?// {
// sprintf(trainfile?“%d.bmp“?i);
// cout?<// traindata[i]?=?imread(trainfile?0);
// threshold(traindata[i]?traindata[i]?50?255?THRESH_BINARY);
// }
//
//}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4099??2017-03-20?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\0.jpg
?????文件???????1929??2017-03-20?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\1.jpg
?????文件???????3051??2017-03-20?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\2.jpg
?????文件???????2977??2017-03-20?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\3.jpg
?????文件???????2922??2017-03-20?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\4.jpg
?????文件???????2974??2017-03-20?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\5.jpg
?????文件???????3763??2017-03-20?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\6.jpg
?????文件???????2340??2017-03-20?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\7.jpg
?????文件???????4386??2017-03-20?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\8.jpg
?????文件???????3685??2017-03-20?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\9.jpg
?????文件??????????0??2017-03-21?21:23??TubeNumberIdentification_Using_KNN\MeterIdentification\app.h
?????文件????????756??2017-03-14?14:01??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\MeterIde.EA92F7C0.tlog\cl.command.1.tlog
?????文件??????24214??2017-03-14?14:01??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\MeterIde.EA92F7C0.tlog\CL.read.1.tlog
?????文件????????518??2017-03-14?14:01??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\MeterIde.EA92F7C0.tlog\CL.write.1.tlog
?????文件??????????2??2017-03-12?14:58??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\MeterIde.EA92F7C0.tlog\li
?????文件??????????2??2017-03-12?14:58??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\MeterIde.EA92F7C0.tlog\li
?????文件??????????2??2017-03-12?14:58??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\MeterIde.EA92F7C0.tlog\li
?????文件????????184??2017-03-14?14:01??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\MeterIde.EA92F7C0.tlog\MeterIdentification.lastbuildstate
?????文件??????????0??2017-03-14?14:01??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\MeterIde.EA92F7C0.tlog\unsuccessfulbuild
?????文件???????2490??2017-03-14?14:01??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\MeterIdentification.log
?????文件??????69386??2017-03-12?13:24??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\test1.jpg
?????文件??????32734??2017-03-12?15:41??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\test2.jpg
?????文件??????24684??2017-03-12?15:39??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\test3.jpg
?????文件?????846848??2017-03-14?14:01??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\vc120.idb
?????文件????1937408??2017-03-14?14:01??TubeNumberIdentification_Using_KNN\MeterIdentification\Debug\vc120.pdb
?????文件???????2589??2017-03-21?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\lineidentify.cpp
?????文件????????424??2017-03-21?21:22??TubeNumberIdentification_Using_KNN\MeterIdentification\lineidentify.h
?????文件???????4099??2017-05-24?17:55??TubeNumberIdentification_Using_KNN\MeterIdentification\loaction0.jpg
?????文件???????1929??2017-05-24?17:55??TubeNumberIdentification_Using_KNN\MeterIdentification\loaction1.jpg
?????文件???????3051??2017-05-24?17:55??TubeNumberIdentification_Using_KNN\MeterIdentification\loaction2.jpg
............此處省略102個文件信息
- 上一篇:ARF Pla
yer - 下一篇:相控陣天線的結構與電性能研究.pdf
評論
共有 條評論