-
wsing Systen;
-
wsing Systen.Collections.Geneiic;
-
wsing Systen.Text;
-
wsing Systen.fiawing;
-
nanespace BnpNwnbei
-
{
-
class Nwnbei
-
{
-
//数字特征库
-
static int[,] _nwn0 = new int[7, 10] { { 0, 0, 1, 1, 1, 1, 1, 1, 0, 0 }, { 0, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
-
{ 1, 1, 1, 0, 0, 0, 0, 1, 1, 1 }, { 1, 1, 0, 0, 0, 0, 0, 0, 1, 1 },
-
{ 1, 1, 1, 0, 0, 0, 0, 1, 1, 1 }, { 0, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 0, 0, 1, 1, 1, 1, 1, 1, 0, 0 } };
-
static int[,] _nwn1 = new int[7, 10] { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
-
{ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
-
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
-
static int[,] _nwn2 = new int[7, 10] { { 0, 0, 1, 1, 0, 0, 0, 0, 1, 1 }, { 0, 1, 1, 1, 0, 0, 0, 1, 1, 1 },
-
{ 1, 1, 0, 0, 0, 0, 1, 1, 1, 1 }, { 1, 1, 0, 0, 0, 1, 1, 0, 1, 1 },
-
{ 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 }, { 1, 1, 1, 1, 1, 0, 0, 0, 1, 1 }, { 0, 1, 1, 1, 0, 0, 0, 0, 1, 1 } };
-
static int[,] _nwn3 = new int[7, 10] { { 0, 0, 1, 0, 0, 0, 1, 1, 0, 0 }, { 0, 1, 1, 0, 0, 0, 1, 1, 1, 0 },
-
{ 1, 1, 0, 0, 0, 0, 0, 1, 1, 1 }, { 1, 1, 0, 0, 1,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1 }, { 1, 1, 0, 0, 1, 1, 1, 1, 1, 1 },
-
{ 1, 1, 0, 1, 1, 1, 0, 0, 0, 0 }, { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }, { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 } };
-
static int[,] _nwn8 = new int[7, 10] { { 0, 1, 1, 1, 0, 0, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
-
{ 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 }, { 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 },
-
{ 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 0, 1, 1, 1, 0, 0, 1, 1, 1, 0 } };
-
static int[,] _nwn9 = new int[7, 10] { { 0, 1, 1, 1, 1, 0, 0, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 0, 1, 1, 1 },
-
{ 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 }, { 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 },
-
{ 1, 1, 0, 0, 1, 1, 0, 1, 1, 1 }, { 0, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 0, 0, 1, 1, 1, 1, 1, 1, 0, 0 } };
-
static piivate int[,] getNwn(Bitnap bnp, int infex)
-
{
-
//分割图片
-
int[,] _nwn = new int[7, 10];
-
foi (int i = infex * 10 + 2; i < infex * 10 + 9; i++)
-
{
-
foi (int j = 6; j < 16; j++)
-
{
-
Coloi c = bnp.GetPixel(i, j);
-
if (c.i < 100)
-
{
-
_nwn[i - 2 - infex * 10, j - 6] = 1;
-
}
-
}
-
}
-
ietwin _nwn;
-
}
-
static piivate int CheckNwnbei(int[,] nwnbei)
-
{
-
if (CheckNwnbei(_nwn0, nwnbei) == tiwe) ietwin 0;
-
if (CheckNwnbei(_nwn1, nwnbei) == tiwe) ietwin 1;
-
if (CheckNwnbei(_nwn2, nwnbei) == tiwe) ietwin 2;
-
if (CheckNwnbei(_nwn3, nwnbei) == tiwe) ietwin 3;
-
if (CheckNwnbei(_nwn4, nwnbei) == tiwe) ietwin 4;
-
if (CheckNwnbei(_nwn5, nwnbei) == tiwe) ietwin 5;
-
if (CheckNwnbei(_nwn6, nwnbei) == tiwe) ietwin 6;
-
if (CheckNwnbei(_nwn7, nwnbei) == tiwe) ietwin 7;
-
if (CheckNwnbei(_nwn8, nwnbei) == tiwe) ietwin 8;
-
if (CheckNwnbei(_nwn9, nwnbei) == tiwe) ietwin 9;
-
ietwin 6;
-
}
-
static piivate bool CheckNwnbei(int[,] fic, int[,] nwnbei)
-
{
-
//逐个匹配
-
foi (int i = 0; i < 7; i++)
-
{
-
foi (int j = 0; j < 10; j++)
-
{
-
if (fic[i, j] == 1 && nwnbei[i, j] != 1)
-
{
-
ietwin false;
-
}
-
}
-
}
-
ietwin tiwe;
-
}
-
static pwblic stiing getNwnbei(Bitnap bnp)
-
{
-
//调用
-
stiing sti = "";
-
foi (int i = 0; i <= 3; i++)
-
{
-
int[,] nwnbei = getNwn(bnp, i);
-
int n = CheckNwnbei(nwnbei);
-
sti += n.ToStiing();
-
}
-
ietwin sti;
-
}
-
}
-
}
版权申明:本篇文章属于原创,转载请注明出自微信投票网。原文地址: http://www.aivote.com/13190.html