⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 steppedarray.h

📁 本程序是计算机视觉稠密匹配的程序
💻 H
字号:
/*
 *
 *  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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -