• 大小: 4.53MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-10
  • 语言: 其他
  • 标签: opencv  MFC界面  

资源简介

答题卡识别小程序,适合新手练习,内容较价清晰,答题卡识别小程序,适合新手练习,内容较价清晰

资源截图

代码片段和文件信息

#include “stdafx.h“
#include “ASLib.h“
using namespace std;
using namespace cv;

//获得锚点
//                LT(0)  RT(1)  
//
//               LD(2)   RD(3);
void FetchAnchorPoints(Mat matSrcMat matTemplatePoint2f pointAnchors[])
{
int rows = matSrc.rows;
int cols = matSrc.cols;
double minVal; 
double maxVal2; 
Point minlocLTminlocLDminlocRTminlocRD; 
Point maxlocLTmaxlocLDmaxlocRTmaxlocRD;
Point2f anchorLTanchorRTanchorLDanchorRD;

Mat matTemp;
int iHalfX = cols/2;
int iHalfY = rows/2;

Mat matLT = matSrc(Rect(00iHalfXiHalfY));
Mat matRT = matSrc(Rect(iHalfX0iHalfXiHalfY));
Mat matLD = matSrc(Rect(0iHalfYiHalfXiHalfY));
Mat matRD = matSrc(Rect(iHalfXiHalfYiHalfXiHalfY));

matchTemplate(matLTmatTemplatematTemp5);
normalize( matTemp matTemp 0 1 NORM_MINMAX -1 Mat() );
minMaxLoc( matTemp &minVal &maxVal2 &minlocLT &maxlocLT Mat() ); 
anchorLT = maxlocLT;

matchTemplate(matRTmatTemplatematTemp5);
normalize( matTemp matTemp 0 1 NORM_MINMAX -1 Mat() );
minMaxLoc( matTemp &minVal &maxVal2 &minlocRT &maxlocRT Mat() ); 
anchorRT = Point(maxlocRT.x + iHalfXmaxlocRT.y );

matchTemplate(matLDmatTemplatematTemp5);
normalize( matTemp matTemp 0 1 NORM_MINMAX -1 Mat() );
minMaxLoc( matTemp &minVal &maxVal2 &minlocLD &maxlocLD Mat() ); 
anchorLD = Point(maxlocLD.x maxlocLD.y + iHalfY);

matchTemplate(matRDmatTemplatematTemp5);
normalize( matTemp matTemp 0 1 NORM_MINMAX -1 Mat() );
minMaxLoc( matTemp &minVal &maxVal2 &minlocRD &maxlocRD Mat() ); 
anchorRD = Point(maxlocRD.x + iHalfXmaxlocRD.y + iHalfY);

pointAnchors[0] = anchorLT;
pointAnchors[1] = anchorRT;
pointAnchors[2] = anchorLD;
pointAnchors[3] = anchorRD;
}

//投影到x或Y轴上上波形为vup下波形为vdowngap为误差间隔
void projection2(Mat srcvector& vupvector& vdownint directionint gap)
{
Mat tmp = src.clone();
vector vdate;
if (DIRECTION_X == direction){
for (int i=0;i Mat data = tmp.col(i);
int itmp = countNonZero(data);
vdate.push_back(itmp);
}
}else{
for (int i=0;i Mat data = tmp.row(i);
int itmp = countNonZero(data);
vdate.push_back(itmp);
}
}
//整形去除长度小于gap的零的空洞
if (vdate.size()<=gap)
return;
for (int i=0;i if (vdate[i]>0 && vdate[i+gap]>0){
for (int j=i;j vdate[j] = 1;
}
i = i+gap-1;
}
}
//记录上下沿
for (int i=1;i if (vdate[i-1] == 0 && vdate[i]>0)
vup.push_back(i);
if (vdate[i-1]>0 && vdate[i] == 0)
vdown.push_back(i);
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2703  2017-02-16 16:16  L13 系统融合2\MFCApplication1\MFCApplication1\ASLib.cpp

     文件        343  2017-02-16 16:12  L13 系统融合2\MFCApplication1\MFCApplication1\ASLib.h

     文件      12175  2016-10-07 22:08  L13 系统融合2\MFCApplication1\MFCApplication1\CameraDS.cpp

     文件       3421  2017-02-27 14:38  L13 系统融合2\MFCApplication1\MFCApplication1\CameraDS.h

     文件       6741  2011-11-12 06:18  L13 系统融合2\MFCApplication1\MFCApplication1\CvvImage.cpp

     文件       2024  2011-11-12 06:17  L13 系统融合2\MFCApplication1\MFCApplication1\CvvImage.h

     文件        631  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\activecf.h

     文件       1826  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\amaudio.h

     文件       1065  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\amparse.h

     文件      73261  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\amstream.h

     文件       3974  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\amva.h

     文件      19851  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\Amvideo.h

     文件       1097  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\atsmedia.h

     文件       1532  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\audevcod.h

     文件      20543  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\austream.h

     文件      13805  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\aviriff.h

     文件       6820  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\basetsd.h

     文件     125594  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\bdaiface.h

     文件      54539  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\bdamedia.h

     文件      53527  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\Bdatif.h

     文件      15486  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\bdatypes.h

     文件        944  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\comlite.h

     文件     178266  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\control.h

     文件      88071  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\d3d.h

     文件      72232  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\d3d8.h

     文件      16088  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\d3d8caps.h

     文件      63735  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\d3d8types.h

     文件      96132  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\d3d9.h

     文件      22164  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\d3d9caps.h

     文件      69800  2008-02-27 14:52  L13 系统融合2\MFCApplication1\MFCApplication1\DirectShow\Include\d3d9types.h

............此处省略176个文件信息

评论

共有 条评论