vlmask.cpp

来自「hough变换的代码」· C++ 代码 · 共 57 行

CPP
57
字号
// vlMask.cpp: implementation of the CvlMask class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "airImg.h"
#include "vlMask.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CvlMask::CvlMask()
{
	kernel = NULL;
}

CvlMask::~CvlMask()
{
	if (kernel)
	{
		delete kernel;
	}
}

void CvlMask::vlMaskCreate(int w, int h, float* k)
{
	int r,c,index;

	if (kernel=new float[w*h*sizeof(float)])
	{
		width = w;
		height = h;
	}

	if (k)
	{
		for (r=0;r<h;r++)
			for (c=0;c<w;c++)
			{
				index = r*width + c;
				kernel[index] = k[index];
			}
	}
	else
	{
		MessageBox(NULL,"malloc failed","warnning!",MB_OK);
	}

	return;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?