HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Image Class Referenceabstract

#include <Image.h>

+ Inheritance diagram for Image:

Public Types

enum  BaseType {
  BaseType::UINT8, BaseType::INT8, BaseType::UINT16, BaseType::INT16,
  BaseType::HALF, BaseType::FLOAT
}
 

Public Member Functions

 ~Image ()
 
IMFUTIL_EXPORT Image ()
 
virtual IMFUTIL_EXPORT ~Image ()
 
IMFUTIL_EXPORT LevelMode levelMode () const
 
IMFUTIL_EXPORT LevelRoundingMode levelRoundingMode () const
 
IMFUTIL_EXPORT int numLevels () const
 
IMFUTIL_EXPORT int numXLevels () const
 
IMFUTIL_EXPORT int numYLevels () const
 
IMFUTIL_EXPORT const
IMATH_NAMESPACE::Box2i
dataWindow () const
 
IMFUTIL_EXPORT const
IMATH_NAMESPACE::Box2i
dataWindowForLevel (int l) const
 
IMFUTIL_EXPORT const
IMATH_NAMESPACE::Box2i
dataWindowForLevel (int lx, int ly) const
 
IMFUTIL_EXPORT int levelWidth (int lx) const
 
IMFUTIL_EXPORT int levelHeight (int ly) const
 
IMFUTIL_EXPORT void resize (const IMATH_NAMESPACE::Box2i &dataWindow)
 
virtual IMFUTIL_EXPORT void resize (const IMATH_NAMESPACE::Box2i &dataWindow, LevelMode levelMode, LevelRoundingMode levelRoundingMode)
 
IMFUTIL_EXPORT void shiftPixels (int dx, int dy)
 
IMFUTIL_EXPORT void insertChannel (const std::string &name, PixelType type, int xSampling=1, int ySampling=1, bool pLinear=false)
 
IMFUTIL_EXPORT void insertChannel (const std::string &name, const Channel &channel)
 
IMFUTIL_EXPORT void eraseChannel (const std::string &name)
 
IMFUTIL_EXPORT void clearChannels ()
 
IMFUTIL_EXPORT void renameChannel (const std::string &oldName, const std::string &newName)
 
IMFUTIL_EXPORT void renameChannels (const RenamingMap &oldToNewNames)
 
virtual IMFUTIL_EXPORT ImageLevellevel (int l=0)
 
virtual IMFUTIL_EXPORT const
ImageLevel
level (int l=0) const
 
virtual IMFUTIL_EXPORT ImageLevellevel (int lx, int ly)
 
virtual IMFUTIL_EXPORT const
ImageLevel
level (int lx, int ly) const
 
Property Accessors
unsigned int getWidth () const
 Return the width of the image. More...
 
unsigned int getHeight () const
 Return the height of the image. More...
 
unsigned int getChannelCount () const
 Return the channel count of the image. More...
 
BaseType getBaseType () const
 Return the base type of the image. More...
 
unsigned int getBaseStride () const
 Return the stride of our base type in bytes. More...
 
unsigned int getRowStride () const
 Return the stride of an image row in bytes. More...
 
unsigned int getMaxMipCount () const
 Return the maximum number of mipmaps for this image. More...
 
Texel Accessors
void setTexelColor (unsigned int x, unsigned int y, const Color4 &color)
 
Color4 getTexelColor (unsigned int x, unsigned int y) const
 
Image Analysis
Color4 getAverageColor ()
 Compute the average color of the image. More...
 
bool isUniformColor (Color4 *uniformColor=nullptr)
 
Image Processing
void setUniformColor (const Color4 &color)
 Set all texels of this image to a uniform color. More...
 
void applyMatrixTransform (const Matrix33 &mat)
 Apply the given matrix transform to all texels of this image. More...
 
void applyGammaTransform (float gamma)
 Apply the given gamma transform to all texels of this image. More...
 
ImagePtr copy (unsigned int channelCount, BaseType baseType) const
 Create a copy of this image with the given channel count and base type. More...
 
ImagePtr applyBoxBlur ()
 Apply a 3x3 box blur to this image, returning a new blurred image. More...
 
ImagePtr applyGaussianBlur ()
 Apply a 7x7 Gaussian blur to this image, returning a new blurred image. More...
 
ImagePair splitByLuminance (float luminance)
 
void writeTable (const FilePath &filePath, unsigned int channel)
 
Resource Buffers
void setResourceBuffer (void *buffer)
 Set the resource buffer for this image. More...
 
voidgetResourceBuffer () const
 Return the resource buffer for this image. More...
 
void createResourceBuffer ()
 Allocate a resource buffer for this image that matches its properties. More...
 
void releaseResourceBuffer ()
 Release the resource buffer for this image. More...
 
void setResourceBufferDeallocator (ImageBufferDeallocator deallocator)
 Set the resource buffer deallocator for this image. More...
 
ImageBufferDeallocator getResourceBufferDeallocator () const
 Return the resource buffer deallocator for this image. More...
 
Resource IDs
void setResourceId (unsigned int id)
 Set the resource ID for this image. More...
 
unsigned int getResourceId () const
 Return the resource ID for this image. More...
 

Static Public Member Functions

static ImagePtr create (unsigned int width, unsigned int height, unsigned int channelCount, BaseType baseType=BaseType::UINT8)
 Create an empty image with the given properties. More...
 

Protected Member Functions

 Image (unsigned int width, unsigned int height, unsigned int channelCount, BaseType baseType)
 
virtual ImageLevelnewLevel (int lx, int ly, const IMATH_NAMESPACE::Box2i &dataWindow)=0
 

Protected Attributes

unsigned int _width
 
unsigned int _height
 
unsigned int _channelCount
 
BaseType _baseType
 
void_resourceBuffer
 
ImageBufferDeallocator _resourceBufferDeallocator
 
unsigned int _resourceId = 0
 

Detailed Description

Class representing an image in system memory

Definition at line 45 of file Image.h.

Member Enumeration Documentation

enum Image::BaseType
strong
Enumerator
UINT8 
INT8 
UINT16 
INT16 
HALF 
FLOAT 

Definition at line 48 of file Image.h.

Constructor & Destructor Documentation

Image::~Image ( )
Image::Image ( unsigned int  width,
unsigned int  height,
unsigned int  channelCount,
BaseType  baseType 
)
protected
IMFUTIL_EXPORT Image::Image ( )
virtual IMFUTIL_EXPORT Image::~Image ( )
virtual

Member Function Documentation

ImagePtr Image::applyBoxBlur ( )

Apply a 3x3 box blur to this image, returning a new blurred image.

void Image::applyGammaTransform ( float  gamma)

Apply the given gamma transform to all texels of this image.

ImagePtr Image::applyGaussianBlur ( )

Apply a 7x7 Gaussian blur to this image, returning a new blurred image.

void Image::applyMatrixTransform ( const Matrix33 mat)

Apply the given matrix transform to all texels of this image.

IMFUTIL_EXPORT void Image::clearChannels ( )
ImagePtr Image::copy ( unsigned int  channelCount,
BaseType  baseType 
) const

Create a copy of this image with the given channel count and base type.

static ImagePtr Image::create ( unsigned int  width,
unsigned int  height,
unsigned int  channelCount,
BaseType  baseType = BaseType::UINT8 
)
inlinestatic

Create an empty image with the given properties.

Definition at line 60 of file Image.h.

void Image::createResourceBuffer ( )

Allocate a resource buffer for this image that matches its properties.

IMFUTIL_EXPORT const IMATH_NAMESPACE::Box2i& Image::dataWindow ( ) const
IMFUTIL_EXPORT const IMATH_NAMESPACE::Box2i& Image::dataWindowForLevel ( int  l) const
IMFUTIL_EXPORT const IMATH_NAMESPACE::Box2i& Image::dataWindowForLevel ( int  lx,
int  ly 
) const
IMFUTIL_EXPORT void Image::eraseChannel ( const std::string name)
Color4 Image::getAverageColor ( )

Compute the average color of the image.

unsigned int Image::getBaseStride ( ) const

Return the stride of our base type in bytes.

BaseType Image::getBaseType ( ) const
inline

Return the base type of the image.

Definition at line 89 of file Image.h.

unsigned int Image::getChannelCount ( ) const
inline

Return the channel count of the image.

Definition at line 83 of file Image.h.

unsigned int Image::getHeight ( ) const
inline

Return the height of the image.

Definition at line 77 of file Image.h.

unsigned int Image::getMaxMipCount ( ) const

Return the maximum number of mipmaps for this image.

void* Image::getResourceBuffer ( ) const
inline

Return the resource buffer for this image.

Definition at line 170 of file Image.h.

ImageBufferDeallocator Image::getResourceBufferDeallocator ( ) const
inline

Return the resource buffer deallocator for this image.

Definition at line 188 of file Image.h.

unsigned int Image::getResourceId ( ) const
inline

Return the resource ID for this image.

Definition at line 204 of file Image.h.

unsigned int Image::getRowStride ( ) const
inline

Return the stride of an image row in bytes.

Definition at line 98 of file Image.h.

Color4 Image::getTexelColor ( unsigned int  x,
unsigned int  y 
) const

Return the texel color at the given coordinates. If the coordinates or image resource buffer are invalid, then an exception is thrown.

unsigned int Image::getWidth ( ) const
inline

Return the width of the image.

Definition at line 71 of file Image.h.

IMFUTIL_EXPORT void Image::insertChannel ( const std::string name,
PixelType  type,
int  xSampling = 1,
int  ySampling = 1,
bool  pLinear = false 
)
IMFUTIL_EXPORT void Image::insertChannel ( const std::string name,
const Channel channel 
)
bool Image::isUniformColor ( Color4 uniformColor = nullptr)

Return true if all texels of this image are identical in color.

Parameters
uniformColorReturn the uniform color of the image, if any.
virtual IMFUTIL_EXPORT ImageLevel& Image::level ( int  l = 0)
virtual

Reimplemented in DeepImage, and FlatImage.

virtual IMFUTIL_EXPORT const ImageLevel& Image::level ( int  l = 0) const
virtual

Reimplemented in DeepImage, and FlatImage.

virtual IMFUTIL_EXPORT ImageLevel& Image::level ( int  lx,
int  ly 
)
virtual

Reimplemented in DeepImage, and FlatImage.

virtual IMFUTIL_EXPORT const ImageLevel& Image::level ( int  lx,
int  ly 
) const
virtual

Reimplemented in DeepImage, and FlatImage.

IMFUTIL_EXPORT int Image::levelHeight ( int  ly) const
IMFUTIL_EXPORT LevelMode Image::levelMode ( ) const
IMFUTIL_EXPORT LevelRoundingMode Image::levelRoundingMode ( ) const
IMFUTIL_EXPORT int Image::levelWidth ( int  lx) const
virtual ImageLevel* Image::newLevel ( int  lx,
int  ly,
const IMATH_NAMESPACE::Box2i dataWindow 
)
protectedpure virtual

Implemented in DeepImage, and FlatImage.

IMFUTIL_EXPORT int Image::numLevels ( ) const
IMFUTIL_EXPORT int Image::numXLevels ( ) const
IMFUTIL_EXPORT int Image::numYLevels ( ) const
void Image::releaseResourceBuffer ( )

Release the resource buffer for this image.

IMFUTIL_EXPORT void Image::renameChannel ( const std::string oldName,
const std::string newName 
)
IMFUTIL_EXPORT void Image::renameChannels ( const RenamingMap oldToNewNames)
IMFUTIL_EXPORT void Image::resize ( const IMATH_NAMESPACE::Box2i dataWindow)
virtual IMFUTIL_EXPORT void Image::resize ( const IMATH_NAMESPACE::Box2i dataWindow,
LevelMode  levelMode,
LevelRoundingMode  levelRoundingMode 
)
virtual
void Image::setResourceBuffer ( void buffer)
inline

Set the resource buffer for this image.

Definition at line 164 of file Image.h.

void Image::setResourceBufferDeallocator ( ImageBufferDeallocator  deallocator)
inline

Set the resource buffer deallocator for this image.

Definition at line 182 of file Image.h.

void Image::setResourceId ( unsigned int  id)
inline

Set the resource ID for this image.

Definition at line 198 of file Image.h.

void Image::setTexelColor ( unsigned int  x,
unsigned int  y,
const Color4 color 
)

Set the texel color at the given coordinates. If the coordinates or image resource buffer are invalid, then an exception is thrown.

void Image::setUniformColor ( const Color4 color)

Set all texels of this image to a uniform color.

IMFUTIL_EXPORT void Image::shiftPixels ( int  dx,
int  dy 
)
ImagePair Image::splitByLuminance ( float  luminance)

Split this image by the given luminance threshold, returning the resulting underflow and overflow images.

void Image::writeTable ( const FilePath filePath,
unsigned int  channel 
)

Save a channel of this image to disk as a text table, in a format that can be used for curve and surface fitting.

Member Data Documentation

BaseType Image::_baseType
protected

Definition at line 218 of file Image.h.

unsigned int Image::_channelCount
protected

Definition at line 217 of file Image.h.

unsigned int Image::_height
protected

Definition at line 216 of file Image.h.

void* Image::_resourceBuffer
protected

Definition at line 220 of file Image.h.

ImageBufferDeallocator Image::_resourceBufferDeallocator
protected

Definition at line 221 of file Image.h.

unsigned int Image::_resourceId = 0
protected

Definition at line 222 of file Image.h.

unsigned int Image::_width
protected

Definition at line 215 of file Image.h.


The documentation for this class was generated from the following files: