91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 56.75MB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2023-02-18
  • 語言: C/C++
  • 標簽: opencv??C++??

資源簡介

opencv手寫數(shù)字識別

資源截圖

代碼片段和文件信息

#include?“stdafx.h“
#include?“cvapp.h“
#include?“math.h“

ImageProcessor?*proc?=?0;
int?H;//圖像高度
int?W;//圖像寬度

//計算直線距離
int?dst(int?xint?yfloat?afloat?bfloat?c)
{
return?abs((a*x+b*y+c)/sqrt(a*a+b*b));
}

//用于表示圖像上點的一個結(jié)構(gòu)體
struct?Point
{
int?h;???????//該點高度坐標
int?w;???????//該點寬度坐標
Point(int?aint?b)
{
h=a;
w=b;
}
};

//計算兩點之間距離
int?dst(Point?p1Point?p2)
{
int?dist=sqrt(float((p1.h-p2.h)*(p1.h-p2.h)+(p1.w-p2.w)*(p1.w-p2.w)));
return?dist;
}

//根據(jù)索引獲取一維數(shù)組值
unsigned?char?Getdata(int?hint?wunsigned?char*?data)
{
return?data[h*W+w];
}

//查找p點左上方的點是否為0
bool?checkLU(Point?punsigned?char*?data)
{
if?(p.w==0)//沒有左
return?false;
else?if?(p.h==0)?//沒有上
return?false;
else?if?(Getdata(p.h-1p.w-1data)!=0)//左上方不為0
return?false;
return?true;
}

//查找p點正上方的點是否為0
bool?checkU(Point?punsigned?char*?data)
{
if?(p.h==0)//沒有上
return?false;
else?if?(Getdata(p.h-1p.wdata)!=0)//正上方不為0
return?false;
return?true;
}

//查找p點右上方的點是否為0
bool?checkRU(Point?punsigned?char*?data)
{
if?(p.w==W-1)?//沒有右
return?false;
else?if?(p.h==0)//沒有上
return?false;
else?if?(Getdata(p.h-1p.w+1data)!=0)//右上方不為0
return?false;
return?true;
}

//查找p點正左方的點是否為0
bool?checkL(Point?punsigned?char*?data)
{
if?(p.w==0)?//沒有左
return?false;
else?if?(Getdata(p.hp.w-1data)!=0)//正左方不為0
return?false;
return?true;
}

//查找p點正右方的點是否為0
bool?checkR(Point?punsigned?char*?data)
{
if?(p.w==W-1)?//沒有右
return?false;
else?if?(Getdata(p.hp.w+1data)!=0)//正右方不為0
return?false;
return?true;
}

//查找p點左下方的點是否為0
bool?checkLD(Point?punsigned?char*?data)
{
if?(p.w==0)?//沒有左
return?false;
else?if?(p.h==H-1)//沒有下
return?false;
else?if?(Getdata(p.h+1p.w-1data)!=0)//左下方不為0
return?false;
return?true;
}

//查找p點正下方的點是否為0
bool?checkD(Point?punsigned?char*?data)
{
if?(p.h==H-1)//沒有下
return?false;
else?if?(Getdata(p.h+1p.wdata)!=0)//正下方不為0
return?false;
return?true;
}

//查找p點右下方的點是否為0
bool?checkRD(Point?punsigned?char*?data)
{
if?(p.w==W-1)?//沒有右
return?false;
else?if?(p.h==H-1)//沒有下
return?false;
else?if?(Getdata(p.h+1p.w+1data)!=0)//右下方不為0
return?false;
return?true;
}

//尋找從點p開始,最左最上的點
Point?Find_LU(Point?punsigned?char*?data)
{
Point?p1=pp2=p;
int?i=1j=0;
while?(i*=-1)?//讓i在1和-1之間來回切換,用于記錄最近兩個時刻所要求的目標點
{
if?(checkLU(pdata))//左上方
{
if?(i==1)?
{
if?(p.h-1!=p1.h||p.w-1!=p1.w)?//查找的點為新點
p1=Point(p.h-1p.w-1);
else?break;//改點已經(jīng)找過,則改點為要找的點
}
else
{
if?(p.h-1!=p2.h||p.w-1!=p2.w)?//查找的點為新點
p2=Point(p.h-1p.w-1);
else?break;
}
}
else?if?(checkU(pdata))//上方
{
if(i==1)
{
if?(p.h-1!=p1.h||p.w!=p1.w)?
p1=Point(p.h-1p.w);
else?break;
}
else
{
if?(p.h-1!=p2.h||p.w!=p2.w)?
p2=Point(p.h-1p.w);
else?break;
}
}
else?if?(checkRU(pdata))//右上方
{
if?(i==1)?
{
if?(p.h-

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-10-10?14:54??數(shù)字識別源程序_重要的OpenCV程序\
?????文件???????????0??2015-06-17?11:20??數(shù)字識別源程序_重要的OpenCV程序\1.txt
?????文件???????????0??2015-06-17?11:20??數(shù)字識別源程序_重要的OpenCV程序\2.txt
?????文件???????????0??2015-06-17?11:20??數(shù)字識別源程序_重要的OpenCV程序\3.txt
?????文件???????????0??2015-06-17?11:20??數(shù)字識別源程序_重要的OpenCV程序\4.txt
?????文件???????31006??2015-06-17?11:18??數(shù)字識別源程序_重要的OpenCV程序\cvapp.cpp
?????文件?????????952??2011-07-12?16:24??數(shù)字識別源程序_重要的OpenCV程序\cvapp.h
?????目錄???????????0??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\
?????文件?????????574??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\BscMake.command.1.tlog
?????文件?????????872??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\bscmake.read.1.tlog
?????文件?????????442??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\bscmake.write.1.tlog
?????文件????????3058??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\cl.command.1.tlog
?????文件???????70996??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\CL.read.1.tlog
?????文件????????1692??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\CL.write.1.tlog
?????文件??????365581??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\cvapp.obj
?????文件???????????0??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\cvapp.sbr
?????文件????12233728??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.bsc
?????文件????????1907??2015-06-17?11:19??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.Build.CppClean.log
?????文件??????137728??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.exe
?????文件?????????667??2015-06-17?11:19??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.exe.embed.manifest
?????文件?????????732??2015-06-17?11:19??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.exe.embed.manifest.res
?????文件?????????381??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.exe.intermediate.manifest
?????文件?????1387100??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.ilk
?????文件??????????87??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.lastbuildstate
?????文件???????10101??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.log
?????文件???????25827??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.obj
?????文件????27590656??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.pch
?????文件?????5803008??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.pdb
?????文件????????2560??2015-06-17?11:19??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.res
?????文件???????????0??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.sbr
?????文件?????????713??2015-10-10?13:59??數(shù)字識別源程序_重要的OpenCV程序\Debug\Imgrcv.vcxprojResolveAssemblyReference.cache
............此處省略71個文件信息

評論

共有 條評論