当前位置: 首页>>代码示例>>C++>>正文


C++ Pixel::GetBW方法代码示例

本文整理汇总了C++中Pixel::GetBW方法的典型用法代码示例。如果您正苦于以下问题:C++ Pixel::GetBW方法的具体用法?C++ Pixel::GetBW怎么用?C++ Pixel::GetBW使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pixel的用法示例。


在下文中一共展示了Pixel::GetBW方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetBW

int Image::GetBW(int X, int Y)
{
	Pixel *pxP = this->GetPixel(X, Y);
	int iBW = pxP->GetBW();
	pxP->~Pixel();

	delete pxP;
	return iBW;
}
开发者ID:ShreyanshDaga,项目名称:ImageProcessing-3,代码行数:9,代码来源:Image.cpp

示例2:

void Pixel::operator = (Pixel &pxArg)
{
	this->iR = pxArg.GetRed();
	this->iG = pxArg.GetGreen();
	this->iB = pxArg.GetBlue();

	this->iBW = pxArg.GetBW();
	this->iX = pxArg.GetPixelX();
	this->iY = pxArg.GetPixelY();
}
开发者ID:JuannyWang,项目名称:ImageProcessing-2,代码行数:10,代码来源:Pixel.cpp

示例3: SetPixel

void Image::SetPixel(int X,int Y, Pixel pxP)
{
	if(this->GetImageColorFormat() == 3)
	{
		this->pImageDate[X][Y*3] = pxP.GetRed();
		this->pImageDate[X][Y*3+1] = pxP.GetGreen();
		this->pImageDate[X][Y*3+2] = pxP.GetBlue();
	}
	else if(this->GetImageColorFormat() == 1)
	{
		this->pImageDate[X][Y] = pxP.GetBW();
	}
}
开发者ID:ShreyanshDaga,项目名称:ImageProcessing-3,代码行数:13,代码来源:Image.cpp

示例4: ComputeFeatures

Feature* ComputeFeatures(Image *pimCharachter)
{
	Feature *pFeat = new Feature();
	double **daImage = pimCharachter->GetDoubleArray(false);
	int iRows = pimCharachter->GetImageRows();
	int iCols = pimCharachter->GetImageCols();

	//Feature 1 Area
	double dA = 0;
	for(int i = 0;i<iRows;i++)
	{
		for(int j = 0;j<iCols;j++)
		{
			Pixel *pxP = pimCharachter->GetPixel(i,j);

			if(pxP->GetBW() == 0)
				dA++;
			delete pxP;
		}
	}	
	pFeat->dArea = dA/((iRows-2)*(iCols-2));

	//Perimeter
	int iaBitQuadWin[2][2];
	double nQ0 = 0, nQ1 = 0, nQ2 = 0, nQ3 = 0, nQ4 = 0, nQD = 0;
	for(int i = 1;i<iRows;i++)
	{
		for(int j = 1;j<iCols;j++)
		{
			//First Bit Quad
			iaBitQuadWin[0][0] = daImage[i-1][j-1];
			iaBitQuadWin[0][1] = daImage[i-1][j];
			iaBitQuadWin[1][0] = daImage[i][j-1];
			iaBitQuadWin[1][1] = daImage[i][j];

			if(CompareBitQuad_Q0(iaBitQuadWin))
				nQ0++;
			if(CompareBitQuad_Q1(iaBitQuadWin))
				nQ1++;
			if(CompareBitQuad_Q2(iaBitQuadWin))
				nQ2++;
			if(CompareBitQuad_Q3(iaBitQuadWin))
				nQ3++;
			if(CompareBitQuad_Q4(iaBitQuadWin))
				nQ4++;
			if(CompareBitQuad_QD(iaBitQuadWin))
				nQD++;

			//Second Bit Quad
			//iaBitQuadWin[0][0] = daImage[i-1][j];
			//iaBitQuadWin[0][1] = daImage[i-1][j+1];
			//iaBitQuadWin[1][0] = daImage[i][j];
			//iaBitQuadWin[1][1] = daImage[i][j+1];
			//
			//if(CompareBitQuad_Q0(iaBitQuadWin))
			//	nQ0++;
			//if(CompareBitQuad_Q1(iaBitQuadWin))
			//	nQ1++;
			//if(CompareBitQuad_Q2(iaBitQuadWin))
			//	nQ2++;
			//if(CompareBitQuad_Q3(iaBitQuadWin))
			//	nQ3++;
			//if(CompareBitQuad_Q4(iaBitQuadWin))
			//	nQ4++;
			//if(CompareBitQuad_QD(iaBitQuadWin))
			//	nQD++;
			//
			////Third Bit Quad
			//iaBitQuadWin[0][0] = daImage[i][j];
			//iaBitQuadWin[0][1] = daImage[i][j+1];
			//iaBitQuadWin[1][0] = daImage[i+1][j];
			//iaBitQuadWin[1][1] = daImage[i+1][j+1];
			//
			//if(CompareBitQuad_Q0(iaBitQuadWin))
			//	nQ0++;
			//if(CompareBitQuad_Q1(iaBitQuadWin))
			//	nQ1++;
			//if(CompareBitQuad_Q2(iaBitQuadWin))
			//	nQ2++;
			//if(CompareBitQuad_Q3(iaBitQuadWin))
			//	nQ3++;
			//if(CompareBitQuad_Q4(iaBitQuadWin))
			//	nQ4++;
			//if(CompareBitQuad_QD(iaBitQuadWin))
			//	nQD++;
			//
			////Fourth Bit Quad
			//iaBitQuadWin[0][0] = daImage[i][j-1];
			//iaBitQuadWin[0][1] = daImage[i][j];
			//iaBitQuadWin[1][0] = daImage[i+1][j-1];
			//iaBitQuadWin[1][1] = daImage[i+1][j];
			//
			//if(CompareBitQuad_Q0(iaBitQuadWin))
			//	nQ0++;
			//if(CompareBitQuad_Q1(iaBitQuadWin))
			//	nQ1++;
			//if(CompareBitQuad_Q2(iaBitQuadWin))
			//	nQ2++;
			//if(CompareBitQuad_Q3(iaBitQuadWin))
			//	nQ3++;
//.........这里部分代码省略.........
开发者ID:ShreyanshDaga,项目名称:ImageProcessing-4,代码行数:101,代码来源:Problem_2.cpp

示例5: GetPixel

Pixel* Image::GetPixel(double dX, double dY)
{
	int X1,Y1;
	double diffA, diffB;
	Pixel *pxP;
	Pixel *pxPout;

	int cRx = 0,cGx = 0,cBx = 0,cBWx = 0;

	X1 = dX;	
	Y1 = dY;	

	diffA = dX - X1;
	diffB = dY - Y1;

	if(diffA == 0.000 && diffB == 0.000)
	{
		return this->GetPixel(X1,Y1);
	}

	if(diffA < 0 || diffB < 0)
	{
		return this->GetPixel(X1,Y1);
	}	

	pxP = this->GetPixel(X1,Y1);
		cBWx = (1.00 - diffA)*(1.00 - diffB)*pxP->GetBW();
		cRx = (1.00 - diffA)*(1.00 - diffB)*pxP->GetRed();
		cGx = (1.00 - diffA)*(1.00 - diffB)*pxP->GetGreen();
		cBx = (1.00 - diffA)*(1.00 - diffB)*pxP->GetBlue();
		//RGB
	delete pxP;
	pxP = this->GetPixel(X1,Y1+1);
		cBWx += (1.00 - diffA)*(diffB)*pxP->GetBW();
		cRx += (1.00 - diffA)*(diffB)*pxP->GetRed();
		cGx += (1.00 - diffA)*(diffB)*pxP->GetGreen();
		cBx += (1.00 - diffA)*(diffB)*pxP->GetBlue();
		//RGB
	delete pxP;
	pxP = this->GetPixel(X1+1,Y1);
		cBWx += (diffA)*(1.00 - diffB)*pxP->GetBW();
		cRx += (diffA)*(1.00 - diffB)*pxP->GetRed();
		cGx += (diffA)*(1.00 - diffB)*pxP->GetGreen();
		cBx += (diffA)*(1.00 - diffB)*pxP->GetBlue();
		//RGB
	delete pxP;
	pxP = this->GetPixel(X1+1,Y1+1);
		cBWx += (diffA)*(diffB)*pxP->GetBW();
		cRx += (diffA)*(diffB)*pxP->GetRed();
		cGx += (diffA)*(diffB)*pxP->GetGreen();
		cBx += (diffA)*(diffB)*pxP->GetBlue();
		//RGB
	delete pxP;

	if(this->iColorFormat == 1)
	{
		pxPout = new Pixel(cBWx);
	}
	else if(this->iColorFormat == 3)
	{
		pxPout = new Pixel(cRx,cGx,cBx);
	}

	return pxPout;
}
开发者ID:ShreyanshDaga,项目名称:ImageProcessing-3,代码行数:65,代码来源:Image.cpp


注:本文中的Pixel::GetBW方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。