steppedarray.h
来自「本程序是计算机视觉稠密匹配的程序」· C头文件 代码 · 共 56 行
H
56 行
/*
*
* All Contents Copyright 2000 by Jared Samet. All Rights Reserved.
*
*/
// SteppedArray.h: interface for the CSteppedArray class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_STEPPEDARRAY_H__8B54E6CC_BF4A_4BD0_93CA_52E8AF29CB89__INCLUDED_)
#define AFX_STEPPEDARRAY_H__8B54E6CC_BF4A_4BD0_93CA_52E8AF29CB89__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
template <class T>
class CSteppedArray
{
public:
CSteppedArray(int cRows, int cCols, int iMinDisp, int iMaxDisp)
: m_cRows(cRows), m_cCols(cCols), m_iMinDisp(iMinDisp), m_iMaxDisp(iMaxDisp)
{
VERIFY(m_iMinDisp <= m_iMaxDisp);
m_pArray = new T[cRows * cCols];
}
T& ElementAt(int iRow, int iCol)
{
VERIFY(iRow < m_cRows && iCol < m_cCols);
VERIFY(0 <= iRow && 0 <= iCol);
VERIFY(m_iMinDisp <= (iRow - iCol) && (iRow - iCol) <= m_iMaxDisp);
return m_pArray[iRow * m_cCols + iCol];
}
bool isValid(int iRow, int iCol)
{
return
(iRow < m_cRows && iCol < m_cCols) &&
(0 <= iRow && 0 <= iCol) &&
(m_iMinDisp <= (iRow - iCol) && (iRow - iCol) <= m_iMaxDisp);
}
virtual ~CSteppedArray()
{
delete [] m_pArray;
}
protected:
int m_cRows, m_cCols, m_iMinDisp, m_iMaxDisp;
T* m_pArray;
};
#endif // !defined(AFX_STEPPEDARRAY_H__8B54E6CC_BF4A_4BD0_93CA_52E8AF29CB89__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?