This class utilises the presence of an OpenGL compliant graphics
board to carry out analysis and synthesis.
The board should supprot certain OpenGL extensions. However, this
requirement can easily be switched of inside the methods. Refer
to the actual code to do this.
However, a reasonable new GPU will support the used extensions,
e.g. a GeForce 2 MX will do. And to be honest, turning of the
need for extentions can easily make the hardware warping *slower*
than the software warping.
If the OpenGL drivers are really crappy it can actually be
slower even without turning the extensions off. So remember to
do some benchmarking on your system before permenantly switching
to OpenGL warping.
CAAMAnalyzeSynthesizeOpenGL( const CAAMReferenceFrame &rf )
-
Constructor.
- Parameters:
- rf - The reference frame to analyze and synthesize through.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
~CAAMAnalyzeSynthesizeOpenGL()
-
Destructor.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
bool Analyze( const CAAMShape &shape, CDMultiBand<TAAMPixel> &refImg, const bool useInterpolation ) const
-
This method samples the image intensities under a user-
supplied shape into a texture vector.
The image is set using the SetAnalyzeImage call.
If a texture vector of the shape is needed instead
call the alternative form of Analyze.
- Parameters:
- shape - A shape in ímage coordinates.
refImg - Output reference image.
useInterpolation - If true bilinear interpolation is used (default).
Otherwise the faster nearest neighbor interpolation
is used.
NOTE: This flag is actually ignored currently in
this OpenGL implementation.
- Returns:
- True is the shape is inside the image.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
- See Also:
- SetAnalyzeImage
bool Analyze( const CAAMShape &shape, CDVector &texture, const bool useInterpolation ) const
-
This method samples the image intensities under a user-
supplied shape into a texture vector.
The image is set using the SetAnalyzeImage call.
If a reference image of the shape is needed instead
call the alternative form of Analyze.
- Parameters:
- shape - A shape in ímage coordinates.
texture - Output texture vector.
useInterpolation - If true bilinear interpolation is used (default).
Otherwise the faster nearest neighbor interpolation
is used.
NOTE: This flag is actually ignored currently in
this OpenGL implementation.
- Returns:
- True is the shape is inside the image.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
- See Also:
- SetAnalyzeImage
void SetupPBuffer( const int w, const int h, PBuffer** pPBuffer )
-
This method constructs a p-buffer and sets up various OpenGL stuff.
Credit goes to NVidea for the p-buffer code.
- Parameters:
- w - P-buffer width.
h - P-buffer height.
pPBuffer - Pointer to a pointer of the newly created p-buffer.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
void ClockReadPixels()
-
This function tries to find the fastest form of the
glReadPixels(). This is typically *very* driver/card-specific.
Results are written to stdout.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-11-2002
void ExtractChannel( const int pixelSize, const int channelNo, unsigned char* pPixels, CDMultiBand<TAAMPixel> &dest )
-
Extracts a channel (band) from an RGB/RGBA image.
- Parameters:
- pixelSize - The size of a pixel in bytes.
channelNo - The channel to extract (zero is the first).
pPixels - Pointer to a continuous pixel-array
(i.e. *no* row-padding etc.) of a
reference image.
dest - Pre-allocated destination image.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-11-2002
bool Synthesize( const CAAMShape &shape, const CDVector &texture, CDMultiBand<TAAMPixel> &destImage, bool renderOntoImage ) const
-
This method renders a texture vector into a shape
defined in image coordinates.
- Parameters:
- shape - The shape to synthesize into.
texture - The input texture vector in byte range [0;255].
destImage - Destination image
renderOntoImage - If true the synthesization is done on top of the
existing image.
- Returns:
- True on success.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
void LoadTexture( const CDMultiBand<TAAMPixel> &textureImage, unsigned int* pTextureId )
-
Loads an image into the texture memory. Expensive call.
- Parameters:
- textureImage - Image to upload to the GPU.
pTextureId - Destination texture id.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
void SetAnalyzeImage( const CDMultiBand<TAAMPixel> &img )
-
Sets the image to be analyzed. Recognize that this means that
the image must be uploaded to the GPU.
Hence, during multiple calls to Analyze on the same image *avoid*
calling SetAnalyze image every time!
- Parameters:
- img - Image to be analyzed.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
CAAMAnalyzeSynthesize* Clone( const CAAMReferenceFrame &rf ) const
-
Clones ifself (smart way to convey type info).
- Parameters:
- rf - The reference frame of the cloned object.
- Returns:
- A cloned object created on the heap.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
bool EnsureSize( const int w, const int h, PBuffer** pPBuffer )
-
The method ensures that the p-buffer is large enough to hold
and image of w * h.
- Parameters:
- w - Desired minimum p-buffer width.
h - Desired minimum p-buffer height.
pPBuffer - Pointer to a p-buffer pointer.
- Returns:
- True the the size of 'pPBuffer' has changed.
- Author:
- Mikkel B. Stegmann
- Version:
- 7-4-2002
void SetImage( const CDMultiBand<TAAMPixel> &img, CDMultiBand<TAAMPixel>** destImage, unsigned int* pTextureId )
-
Uploads an image to the GPU. Don't call this directly.
This method is called by SetAnalyzeImage.
- Parameters:
- img - Input image.
destImage - Pointer to an image pointer of the image actually being uploaded.
pTextureId - Input texture id.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 7-4-2002
- See Also:
- SetAnalyzeImage