ROI indices. More...
#include <WaveletTransform.h>
Public Member Functions | |
UINT32 | GetNofTiles (int level) const |
Private Member Functions | |
CRoiIndices () | |
~CRoiIndices () | |
void | Destroy () |
void | CreateIndices () |
void | ComputeIndices (UINT32 width, UINT32 height, const PGFRect &rect) |
const PGFRect & | GetIndices (int level) const |
void | SetLevels (int levels) |
void | ComputeTileIndex (UINT32 width, UINT32 height, UINT32 pos, bool horizontal, bool isMin) |
Private Attributes | |
int | m_nLevels |
number of levels of the image | |
PGFRect * | m_indices |
array of tile indices (index is level) | |
Friends | |
class | CWaveletTransform |
ROI indices.
PGF ROI and tile support. This is a helper class for CWaveletTransform.
Definition at line 45 of file WaveletTransform.h.
CRoiIndices::CRoiIndices | ( | ) | [inline, private] |
Constructor: Creates a ROI helper object
Definition at line 50 of file WaveletTransform.h.
CRoiIndices::~CRoiIndices | ( | ) | [inline, private] |
void CRoiIndices::ComputeIndices | ( | UINT32 | width, | |
UINT32 | height, | |||
const PGFRect & | rect | |||
) | [private] |
Compute tile indices for given rectangle (ROI)
width | PGF image width | |
height | PGF image height | |
rect | ROI |
Definition at line 603 of file WaveletTransform.cpp.
00603 { 00604 ComputeTileIndex(width, height, rect.left, true, true); 00605 ComputeTileIndex(width, height, rect.top, false, true); 00606 ComputeTileIndex(width, height, rect.right, true, false); 00607 ComputeTileIndex(width, height, rect.bottom, false, false); 00608 }
void CRoiIndices::ComputeTileIndex | ( | UINT32 | width, | |
UINT32 | height, | |||
UINT32 | pos, | |||
bool | horizontal, | |||
bool | isMin | |||
) | [private] |
Computes a tile index either in x- or y-direction for a given image position.
width | PGF image width | |
height | PGF image height | |
pos | A valid image position: (0 <= pos < width) or (0 <= pos < height) | |
horizontal | If true, then pos must be a x-value, otherwise a y-value | |
isMin | If true, then pos is left/top, else pos right/bottom |
Definition at line 561 of file WaveletTransform.cpp.
00561 { 00562 ASSERT(m_indices); 00563 00564 UINT32 m; 00565 UINT32 tileIndex = 0; 00566 UINT32 tileMin = 0, tileMax = (horizontal) ? width : height; 00567 ASSERT(pos <= tileMax); 00568 00569 // compute tile index with binary search 00570 for (int i=m_nLevels - 1; i >= 0; i--) { 00571 // store values 00572 if (horizontal) { 00573 if (isMin) { 00574 m_indices[i].left = tileIndex; 00575 } else { 00576 m_indices[i].right = tileIndex + 1; 00577 } 00578 } else { 00579 if (isMin) { 00580 m_indices[i].top = tileIndex; 00581 } else { 00582 m_indices[i].bottom = tileIndex + 1; 00583 } 00584 } 00585 00586 // compute values 00587 tileIndex <<= 1; 00588 m = tileMin + (tileMax - tileMin)/2; 00589 if (pos >= m) { 00590 tileMin = m; 00591 tileIndex++; 00592 } else { 00593 tileMax = m; 00594 } 00595 } 00596 }
void CRoiIndices::CreateIndices | ( | ) | [private] |
void CRoiIndices::Destroy | ( | ) | [inline, private] |
Definition at line 59 of file WaveletTransform.h.
const PGFRect& CRoiIndices::GetIndices | ( | int | level | ) | const [inline, private] |
Definition at line 62 of file WaveletTransform.h.
UINT32 CRoiIndices::GetNofTiles | ( | int | level | ) | const [inline] |
Returns the number of tiles in one dimension at given level.
level | A wavelet transform pyramid level (>= 0 && < Levels()) |
Definition at line 70 of file WaveletTransform.h.
void CRoiIndices::SetLevels | ( | int | levels | ) | [inline, private] |
Definition at line 63 of file WaveletTransform.h.
00063 { ASSERT(levels > 0); m_nLevels = levels; }
friend class CWaveletTransform [friend] |
Definition at line 46 of file WaveletTransform.h.
PGFRect* CRoiIndices::m_indices [private] |
array of tile indices (index is level)
Definition at line 74 of file WaveletTransform.h.
int CRoiIndices::m_nLevels [private] |
number of levels of the image
Definition at line 73 of file WaveletTransform.h.