Пример #1
0
void CDepthMapSkt::ShiftNN(int column, int row)
{
	CDepthMapSkt bufDepthMap;
	CopyDepthMapTo(bufDepthMap);
	if(column < 0 || row < 0)
	{
		return;
	}
	int r,c;
	for(r=0; r<GetNRows(); r++)
	{
		for(c=0; c<GetNCols(); c++)
		{
			if(r < row || c < column)
			{
				SetItem(r,c, 0.0);
			}
			else
			{
				float shiftedValue = bufDepthMap.GetItem(r-row, c-column);
				SetItem(r, c, shiftedValue);
			}
		}
	}
	return;
}
Пример #2
0
//scale the dimensions:
//ncols = floor(scaleFactor * ncols), nrows = floor(scaleFactor * nrows)
void CDepthMap::ScaleSizeNN(float scaleFactor)
{
	//buffer the original depthmap
	CDepthMap bufDepthMap;
	CopyDepthMapTo(bufDepthMap);

	int new_ncols = floor(m_ncols * scaleFactor);
	int new_nrows = floor(m_nrows * scaleFactor);

	SetSize(new_ncols, new_nrows);

	int r,c;
	for(r=0; r<GetNRows(); r++)
	{
		for(c=0; c<GetNCols(); c++)
		{
			int origR = floor(r/scaleFactor);
			int origC = floor(c/scaleFactor);
			float origVal = bufDepthMap.GetItem(origR, origC);
			SetItem(r,c, origVal);
		}
	}
}