|
|
The origin of the image ogject is in the lower left corner. The class supports data sharing, e.g if image object A is assigned to image object B with B = A, both object share their channel data. Therefore, changing a pixel value in A causes the same change in B. Note that even if several channels are shared with other objects, further channels can be added to the the objects (e.g: A and B consist of 3 shared channels and C consist of 4 channels. After appending the channels of C to B with B.appendImage( C ), B consists of 7 channels; 3 channels shared with A and 4 channels shared with C. Single channels can be appended with appendChannel(..) or replaced with attachChannel(..). Both methods cause data sharing. Data sharing can be removed using detachChannel (e.g. if A=B with 3 channels. After A.detachChannel( 1 ), A is the exclusive owner of its second channel while the channels 0 and 2 remain shared). Using A.detachChannel() would make A to the exclusive owner of all of its channels. Use B = A.deepCopy(), if A should be assigned to B but data sharing should be avoided.
CImageChannel | ppChannels |
[protected]
int iDepth | iDepth |
[protected]
int iWidth | iWidth |
[protected]
int iHeight | iHeight |
[protected]
int iChannels | iChannels |
[protected]
char acName[64] | acName[64] |
[protected]
CImage (int iWidth=1, int iHeight=1, int iChannels=1)
| CImage |
Constructs an image with specified number of channels and size.
Parameters:
iWidth | Width of image |
iHeight | Height of image |
iChannels | Number of Channels |
CImage (const CImage | CImage |
Copy constructor
Parameters:
tSource | Reference of instance to copy |
~CImage ()
| ~CImage |
Destructor
CImage& operator= (const CImage | operator= |
Assign operator. Both images will share their channel data. Use deepCopy() to obtain a copy of an image which is not attached to the source image.
Parameters:
tSource | Reference to source object. |
CImage | convertTo32Bit |
[const]
Returns a copy of the object with depth 32 bit.
Returns: Copy of the object with depth 32 bit
CImage | convertTo16Bit |
[const]
Returns a copy of the object with depth 16 bit. Information may be lost!
Returns: Copy of the object with depth 16 bit
CImage | convertTo8Bit |
[const]
Returns a copy of the object with depth 8 bit. Information may be lost!
Returns: Copy of the object with depth 8 bit
CImage | deepCopy |
[const]
Returns an exact copy of the object.
CImage | getRegion |
[const]
Returns a multi-channel subregion of the image as an image object. The region is specified by the (x,y)-coordinate of the lower left corner and the region's width and height. Note that the region must be completely inside the image.
Parameters:
iX | x-coordinate of upper left corner |
iY | y-coordinate of upper left corner |
iWidth | width of selected region |
iHeight | height of selected region |
Returns: Image of selected region
CImage | extractChannel |
[const]
Extracts channel iSrcChannel to a new CImage. Both images will share the channel data (Shallow copy).
Parameters:
iSrcChannel | Source channel |
Returns: CImage with one channel
void scaleRange (Type tMin, Type tMax, bool bChannelSpecific=false)
| scaleRange |
Scale pixel values from current min and max to new given min and max value. This operation can be applied to each channel separatly or to all channels at once. In the last case min and max of all channels are determined, while in the first case for all channels separatly. After the scaling operation the each channel or all channels have the new specified min and max value. (See CImageChannel:scaleRange for details)
Parameters:
tMin | , tMax New min and max pixel value |
bChannelSpecific | If true, the operation will be applied to each channel seperatly |
void scalelRange (vector | scalelRange |
Scale pixel values from given min/max values to new min/max values. Values exceeding the given range are set to new min/max. (See CImageChannel:scaleRange for deatils)
Parameters:
NewMin | , NewMax, New min/max values |
Min | , Max, Old min/max values |
void clipPercentage (float fMinClip, float fMaxClip, bool bChannelSpecific)
| clipPercentage |
Clips a given percentage of min/max intensity pixels. The intensity of the clipped pixels is set to the min/max of the remaining pixel.
Parameters:
fMinClip | ,fMaxClip Percentage of the pixels that should be clipped. |
bChannelSpecific | If true, the operation will be applied to each channel seperatly |
void setChannelData (const Type* ptSource, int iChannel,int iOrigin=0)
| setChannelData |
Moves the data from the source to the specified image channel. The data has to be in row-by-row format.
Parameters:
ptSource | Pointer to the source data |
iChannel | Channel to fill |
iOrigin | Source data origin (0=lower left corner, 1=upper left corner) |
void getChannelData (Type* ptTarget, int iChannel)
| getChannelData |
[const]
Moves the data from the specified channel to the target The data will be in row-by-row order.
Parameters:
ptTarget | Pointer to the source data |
iChannel | Channel to fill |
Type* getChannelDataPtr (int iChannel)
| getChannelDataPtr |
[const]
Returns pointer to the specified channel data. This method allows direct access to the channel data memory. THIS METHOD ANNULS DATA ENCAPSULATION. DO NOT USE THIS METHOD S ANYMORE. IT WILL BE REMOVED IN FUTURE BECAUSE OF NEW DATA ORGNIZATION CONCEPTS.
Parameters:
iChannel | Channel to get data from |
void getImageData (Type* ptTarget, bool bChannelOrder=true)
| getImageData |
[const]
Fills array with image data in pixel-by-pixel or channel-by-channel order
Parameters:
pTarget | Pointer to memory containing the image data |
bChannelOrdered | If true, the image data is in channel order, otherwise in pixel order (default: true) |
void setImageData (Type* ptTarget, bool bChannelOrder=true, bool bFlipped=false)
| setImageData |
Sets image data for all channels using the data in an array. The data has to be in channel-by-channel or pixel-by-pixel order.
Parameters:
ptSource | Pointer to memory containing the image data |
bChannelOrdered | If true, the image data is assumed to be in channel order, otherwise in pixel order (default: true) |
bFlipped | If true, the image data is assumed to begin in the upper left corner (default: false) |
void getPixel (int iX, int iY, Type* ptTarget)
| getPixel |
[const]
Gets the value of one pixel. The value of the pixel is an array of dimension equal to the number of channels of the image.
Parameters:
iX | X coordinate of the pixel |
iY | Y coordinate of the pixel |
ptTarget | Pointer to memory that will be filled with the pixel data |
void setPixel (int iX, int iY, Type* ptSource)
| setPixel |
Sets the pixel at the specified position to a specified value. The value is an array of dimension equal to the number of channels.
Parameters:
iX | X coordinate of the pixel |
iY | Y coordinate of the pixel |
ptSource | Pointer to memory that contains the data to set |
void setPixel (int iX, int iY, int iChannel,Type tValue)
| setPixel |
Sets the pixel at the specified position in the specified channel to a new value.
Parameters:
iX | X coordinate of the pixel |
iY | Y coordinate of the pixel |
iChannel | Channel index of the point |
tValue | New value of the specified point |
void getRegion (int iX, int iY, int iChannel,int iRegionWidth, int iRegionHeight, Type* ptRegion)
| getRegion |
[const]
Returns a subregion of an image channel. The region is specified by the (x,y)-coordinate of the lower left corner, the region's width and height and the channel index.
Parameters:
iX | x-coordinate of upper left corner |
iY | y-coordinate of upper left corner |
iChannel | channel index |
iWidth | width of selected region |
iHeight | height of selected region |
ptRegion | Ptr to memory to be filled with image data |
void fillChannel (const CImage | fillChannel |
Copies image data of pSrc's channel iSrcChannel to channel iTargetChannel
Parameters:
tSrc | Reference to source image |
iSrcChannel | Source channel |
iTargetChannel | Target channel |
void removeChannel (int iChannel)
| removeChannel |
Removes a specified channel.
Parameters:
iChannel | Index of channel to remove |
void appendImage (const CImage | appendImage |
Append channels of pSrc to the existing channels. Both objects will share their data. Note the width and height of both images must be equal.
Parameters:
pChannel | Reference to instance of CImage |
void swapChannels (int iIndexA, int iIndexB)
| swapChannels |
Swaps channel iIndexA and iIndexB
Parameters:
iIndexA | Index of channel A; |
iIndexB | Index of channel B |
void setName (char* acName)
| setName |
const char* getName ()
| getName |
[const]
void setChannelInfo (const char* pcText, int iChannel)
| setChannelInfo |
Modifies the info of a specified channel (max 63 chars).
Parameters:
pcText | String containing the info text |
iChannel | Index of channel |
const char* getChannelInfo (int iChannel)
| getChannelInfo |
[const]
Returns a pointer to the info text of a channel
Parameters:
iChannel | Index of channel |
Returns: Pointer to info text.
void resize (int iWidth, int iHeight,int iChannels)
| resize |
Changes size and number of image channels. If only the number of channels is incremented, the data of the already existing channels will be remain unchanged and the new channels will be initialized with zeros. If the number of channels is reduced, channels will be deleted while the data of remaining channels will be unchanged. If the width and/or height is changed all data will be destroyed. Shared channels will be detached automatically before resizing.
Parameters:
iWidth | New image width |
iHeight | New image height |
iChannels | New number of channels |
void clear (int iChannel=-1)
| clear |
Sets the pixels of one or all channels to zero
Parameters:
iChannel | Channel to fill with zero (default: -1 = all) |
void cloneChannel (int iSrcChannel,CImage | cloneChannel |
Copys the image data from a specified channel to a specified channel of a seccond image.
Parameters:
iSrcChannel | Index of channel to clone |
pTgtImage | Pointer to targetimage |
iTgtChannel | Index of channel to be filled with the imagedata |
inline
int depth ()
| depth |
[const]
Returns depth of the image channels.
Returns: Depth of image channels
inline
int pixels ()
| pixels |
Returns number of pixels in the images
Returns: Number of pixels
inline
int pixelsPerChannel ()
| pixelsPerChannel |
Returns number of pixels in each channel
Returns: Number of pixels in each channel
int channels ()
| channels |
[const]
Returns number of the image channels.
Returns: Number of image channels
int width ()
| width |
[const]
Returns image width.
Returns: Width
int height ()
| height |
[const]
Returns image height.
Returns: Height
int getFilteredPixel (int iX, int iY, bool* pbMask,Type* ptTarget)
| getFilteredPixel |
[const]
Gets a pixel pillar of the channels specified by the mask pbMask.
Parameters:
iX | X coordinate of the pixel |
iY | Y coordinate of the pixel |
pbMask | Array (dim = #channels) of bool values that select/deselect channels (true = selected, false = deselected). |
ptTarget | Pointer to memory that will be filled with the pixel data |
Returns: Number of elements filled in ptTarget
Type getPixel (int iX, int iY, int iChannel=0)
| getPixel |
[const]
Insteed of the previous version of getPixel(..), this version returns the value at the specified position in the specified channel.
Parameters:
iX | X coordinate of the pixel |
iY | Y coordinate of the pixel |
iChannel | Channel index (default 0) |
Returns: Value of specified point
Type max (int iChannel)
| max |
[const]
Returns max pixel value of channel iChannel
Parameters:
iChannel | Index of channel |
Type min (int iChannel)
| min |
[const]
Returns min pixel value of channel iChannel
Parameters:
iChannel | Index of channel |
vector | histogram |
[const]
Calculates a histogram given min, max, #bins
Parameters:
iChannel | Channel number for histogram |
fMin | Minimum bin value |
fMax | Maximum bin value |
iNbBins | Number of bins |
Type interpolate (float fX, float fY,int iChannel=0)
| interpolate |
[const]
Bilinear interpolation for 'subpixel' values.
Parameters:
fX | X coordinate of the pixel |
fY | Y coordinate of the pixel |
iChannel | Channel index (default 0) |
Returns: Value of the specified point
char* describe ()
| describe |
[const]
Returns: description string for image.
CImage | copy |
[const]
Create copy of image. Reuse instance pTo if specified.
Returns: pointer to create image or pTo.
bool isAttached ()
| isAttached |
[const]
Returns true if one or more channels are shared between several objects.
Returns: True if channel data is shared
void detach (int iIndex = -1)
| detach |
[const]
Makes the image to the only owner of the channel data (if iIndex = -1). If iIndex is an legal channel index only the corresponding channel will be detached.
void attachChannel (int iThisChannel, int iThatChannel, const CImage | attachChannel |
Attachs the channel iThisChannel to the channel iThatChannel of the object rtThatImage. Both images must have the same width and height.
Parameters:
iThisChannel | Channel index to attach |
iThatChannel | Channel index to attach to. |
rtThatImage | Image object containing rtThatImage |
void appendChannel (int iChannel, const CImage | appendChannel |
Appends the channel iChannel of image rtImage to the image. The images must have the same width and height. Both image will share their data.
Parameters:
iThisChannel | Channel index to append |
rtImage | Image object containing rtThatImageproviding the channel |
Type* getChannelPtr (int iIndex)
| getChannelPtr |
[const]
Returns pointer to the specified channel data. This method allows direct access to the channel data memory. THIS METHOD ANNULS DATA ENCAPSULATION. DO NOT USE THIS METHOD S ANYMORE. IT WILL BE REMOVED IN FUTURE BECAUSE OF NEW DATA ORGNIZATION CONCEPTS.
Parameters:
iChannel | Channel to get data from |
void findMinMax (Type& tMin, Type& tMax)
| findMinMax |
[const]
Detects the minimal and maximal value regarding all channels
CImage | rotate |
Rotate image by angle fAngle (degree) with origin (fXOrigin, fYOrigin) If origin is equal to (-1,-1), the image center will be used.
Parameters:
fAngle | Angle in degree |
fXOrigin | x-coordinate of rotation origin |
fYOrigin | y-coordinate of rotation origin |
CImage | scale |
[const]
Scale image by factor fFactor. Using different methods (Simple, BiLinInter, Average) According to the selected method the pixels in the returned image are build of one pixel (simple), bilinear interpolation of four pixels (BiLinInter) or the average of a region (average) from the source image.
Parameters:
fFactor | Scaling factor |
method | Scaling method |