📄 hdg.cpp
字号:
// hdg.cpp: implementation of the Chdg class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "tryshot.h"
#include "hdg.h"
#include "math.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
// 这个类里保存各种数据处理的方法
// 其中以Pic开头的函数标识图像处理的方法
//////////////////////////////////////////////////////////////////////
Chdg::Chdg()
{
}
Chdg::~Chdg()
{
}
double Chdg::cacuangle(double *pA, double *pB, int ndimension)
{
double da=0;
double db=0;
double dc=0;
for (int n=0;n<ndimension;n++)
{
da=da+*(pA+n)**(pA+n);
db=db+*(pB+n)**(pB+n);
dc=dc+*(pA+n)**(pB+n);
}
// double drprlt=(180/3.14)*acos(dc/sqrt(da*db));
return (180/3.14)*acos(dc/sqrt(da*db));
}
BOOL Chdg::getmask(BYTE *pout, BYTE *pin, int z_row, int z_col, int z_deep)
{
//将pin转化为mask,到pout
BOOL brlt=TRUE;
BYTE *pGray=new BYTE[z_row*z_col];
//先计算灰度
rgb2gray(pGray,pin,z_row,z_col,z_deep);
//根据门限进行二值化
//腐蚀
//膨胀
//根据门限进行二值化
//得到mask
delete []pGray;
return brlt;
}
BOOL Chdg::rgb2gray(BYTE *pout, BYTE *pin, int z_row, int z_col, int z_deep)
{
BOOL brlt=TRUE;
//----彩色转灰度的公式
return brlt;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -