資源簡介
1、代碼是基于一篇文章:一種改進的基于灰度投影的人眼定位算法.pdf
2、由于工程太大,只上傳了.h和.cpp文件,自己新建工程,搭配好opencv環境即可運行。如不會可留言。
3、效果可參考我寫的博客:http://blog.csdn.net/raby_gyl/article/details/12104877
4、代碼是自己寫的,笨拙,僅供初學者參考。

代碼片段和文件信息
#include?“Area.h“
#include“math.h“
double??Area::jisuanM(Mat?matint?type)
{
double?M=0;
int?width=mat.cols;
int?height=mat.rows;
for(int?i=0;i for(int?j=0;j {
????????????switch(type)
???????{
case?0:
M+=(double)mat.at(ij);break;
case?10:
M+=(double)(i*mat.at(ij));break;
case?1:
M+=(double)(j*mat.at(ij));break;
case?2:
M+=(double)(j*j*mat.at(ij));break;
case?20:
M+=(double)(i*i*mat.at(ij));break;
????????}
}
???return?M;
}
void?Area::getArea(cv::Mat?mat)
{
???double?M00=jisuanM(matCV_M00);
???double?M01=jisuanM(matCV_M01);
???double?M10=jisuanM(matCV_M10);
???double?M02=jisuanM(matCV_M02);
???double?M20=jisuanM(matCV_M20);
???x=(int)(?M10*(1.0/M00));
???y=(int)(M01*(1.0/M00));
???double?xx=M20*(1.0/M00)-x*x;
???double?yy=M02*(1.0/M00)-y*y;
???width=(int)(3*sqrt(xx));
???height=(int)(3*sqrt(yy));
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????969??2013-09-27?11:40??基于opencv人眼定位算法(C++工程)\Area.cpp
?????文件????????353??2013-09-27?17:25??基于opencv人眼定位算法(C++工程)\Area.h
?????文件????????483??2013-09-25?21:06??基于opencv人眼定位算法(C++工程)\Hist.cpp
?????文件????????201??2013-09-25?20:19??基于opencv人眼定位算法(C++工程)\Hist.h
?????文件???????7169??2013-09-27?17:22??基于opencv人眼定位算法(C++工程)\main.cpp
?????文件???????2693??2013-08-07?12:09??基于opencv人眼定位算法(C++工程)\precomp.hpp
?????文件????????217??2013-09-07?16:06??基于opencv人眼定位算法(C++工程)\stdafx.cpp
?????文件????????233??2013-09-07?16:06??基于opencv人眼定位算法(C++工程)\stdafx.h
?????文件????????498??2013-09-07?16:06??基于opencv人眼定位算法(C++工程)\targetver.h
?????目錄??????????0??2013-09-27?18:10??基于opencv人眼定位算法(C++工程)
-----------?---------??----------?-----??----
????????????????12816????????????????????10
評論
共有 條評論