#include "dvcImage.h"
Public Member Functions | |
| BOOL | Add (int nConstant) |
| BOOL | Add (CDVCImage *pSrcImage) |
| BOOL | And (int nConstant) |
| BOOL | And (CDVCImage *pSrcImage) |
| CDVCImage (char *szFileName) | |
| CDVCImage (PVOID pImageData, int w, int h, int bpp) | |
| CDVCImage (const CDVCImage &rImg) | |
| CDVCImage () | |
| BOOL | CloseFile () |
| BOOL | Copy (CDVCImage *pSrcImage) |
| BOOL | Create (ULONG nWidth, ULONG nHeight, ULONG nBytesPerPixel) |
| BOOL | Divide (int nConstant, double dScaleResult) |
| BOOL | Divide (CDVCImage *pDivisorImage, double dScaleResult, BOOL bClipTo12Bits=FALSE) |
| BOOL | DivideCopy (CDVCImage *pSrcImage, int nConstant, BOOL bClipTo12Bits=FALSE) |
| int | GetBitsPerPixel () |
| BOOL | GetIndex (int *pIndex) |
| BOOL | GetMetaData (ImageMetaDataP pMeta) |
| BOOL | GetRenderMethod (dvcRenderControl_t *pRenderOp) |
| BOOL | GetSize (int *pWidth, int *pHeight, int *pDepth) |
| BOOL | GetSize (PULONG pWidth, PULONG pHeight) |
| ULONG | HistogramFreq (ULONG nBin) |
| BOOL | HistogramMask (CDVCImage *pMask, double *pMean, double *pStdDev, ULONG *pMin, ULONG *pMax) |
| BOOL | HistogramStats (double *pMean, double *pStdDev, ULONG *pMin, ULONG *pMax) |
| int | Lock (PVOID *ppBuffer, PULONG pWidth, PULONG pHeight, PULONG pDepth) |
| BOOL | Multiply (CDVCImage *pMultiplierImage, double dScaleResult) |
| BOOL | Not (int nConstant) |
| BOOL | Not (CDVCImage *pSrcImage) |
| BOOL | OpenFile (LPSTR szFileName) |
| CDVCImage & | operator *= (double k) |
| CDVCImage & | operator *= (int k) |
| CDVCImage & | operator *= (CDVCImage &rImg) |
| CDVCImage & | operator+= (int k) |
| CDVCImage & | operator+= (CDVCImage &rImg) |
| CDVCImage & | operator-= (int k) |
| CDVCImage & | operator-= (CDVCImage &rImg) |
| CDVCImage & | operator/= (double d) |
| CDVCImage & | operator/= (int k) |
| CDVCImage & | operator/= (CDVCImage &rImg) |
| CDVCImage & | operator= (int k) |
| CDVCImage & | operator= (CDVCImage &rImg) |
| BOOL | Or (int nConstant) |
| BOOL | Or (CDVCImage *pSrcImage) |
| BOOL | ReadCamera (HANDLE hDevice, ULONG uLeft, ULONG uTop, ULONG uWidth, ULONG uHeight) |
| BOOL | ReadFile () |
| BOOL | ReadPixel (ULONG x, ULONG y, PULONG pPixData) |
| BOOL | ReadRect (RECT *pRect, PVOID pPixData) |
| BOOL | ReadRoi (ULONG x, ULONG y, ULONG width, ULONG height, PVOID pPixData) |
| BOOL | ReadRow (ULONG x, ULONG y, ULONG width, PVOID pPixData) |
| int | Release (void) |
| BOOL | Render (LPSTR szFileName, RECT *pSrcRect, BYTE bBitsPerPixel, int nAppend=0) |
| BOOL | Render (PVOID pRGBBuffer, RECT *pSrcRect, ULONG ulBytesPerLine, BYTE bBitsPerPixel, ULONG ulBufferLines=0) |
| BOOL | ScaleLuts (int nRangeLow=-1, int nRangeHigh=-1) |
| BOOL | SetIndex (int nIndex) |
| BOOL | SetMetaData (ImageMetaDataP pMeta) |
| BOOL | SetRenderMethod (dvcRenderControl_t *pRenderOp) |
| BOOL | Subtract (CDVCImage *pSubImage, int nOffset) |
| BOOL | Subtract (CDVCImage *pSubImage) |
| BOOL | SubtractDivide (CDVCImage *pFlatImage, CDVCImage *pBkgImage, double dScaleResult, BOOL bClipTo12Bits=FALSE) |
| BOOL | Xor (int nConstant) |
| BOOL | Xor (CDVCImage *pSrcImage) |
| virtual | ~CDVCImage () |
All methods with a BOOL return type return a TRUE on success of FALSE if an error occurs.
This class maintains a private set of meta data which is automatically updated from a camera when the ReadCamera() method is called and saved with the Render() method.
avgdvc.cpp, and FullScreen.cpp.
| CDVCImage::CDVCImage | ( | ) |
Create an instance of a DVC Image Class
| CDVCImage::CDVCImage | ( | const CDVCImage & | rImg | ) |
Copy an Image
| rImg | source image to be copied. |
| CDVCImage::CDVCImage | ( | PVOID | pImageData, | |
| int | w, | |||
| int | h, | |||
| int | bpp | |||
| ) |
Create an Image from a buffer of given width, height and depth.
| pImageData | pointer to an image buffer with bpp bytes per pixel. | |
| w | width in pixels of the pImageData buffer. | |
| h | height in pixels of the pImageData buffer. | |
| bpp | number of bytes per pixel. |
| CDVCImage::CDVCImage | ( | char * | szFileName | ) |
Instantiates a DVC Image Class from a file. Supported file types are TIF, JPEG and BMP.
| szFileName | file path and name of the image file to open. |
| CDVCImage::~CDVCImage | ( | ) | [virtual] |
close an image and release all resources.
| BOOL CDVCImage::Add | ( | int | nConstant | ) |
Add a constant integer to an image.
this(x,y) += nConstant
| nConstant | constant added to each pixel. Output is clipped to the maximum DN of the original image. |
| BOOL CDVCImage::Add | ( | CDVCImage * | pSrcImage | ) |
Add two images.
this(x,y) += pSrcImage(x,y)
| pSrcImage | source image for pixel by pixel addition. Output is clipped to the maximum DN of the original image. |
| BOOL CDVCImage::And | ( | int | nConstant | ) |
Bitwise logical AND of an image and a constant.
this(x,y) &= nConstant
| nConstant | AND'd with each pixel. |
| BOOL CDVCImage::And | ( | CDVCImage * | pSrcImage | ) |
Bitwise logical AND of two images.
this(x,y) &= pSrcImage(x,y)
| pSrcImage | source image for pixel by pixel AND operation. |
| CDVCImage::CloseFile | ( | ) |
Close an open image file and releases disk and system resources.
| BOOL CDVCImage::Copy | ( | CDVCImage * | pSrcImage | ) |
Copy an image
| pSrcImage | the source image to copy. If a different size or depth, the resulting image is resized to match pSrcImage. |
| BOOL CDVCImage::Create | ( | ULONG | nWidth, | |
| ULONG | nHeight, | |||
| ULONG | nBytesPerPixel | |||
| ) |
Create and allocate memory for an image of a given width x height x bytes
| nWidth | width of image in pixels | |
| nHeight | height of image in pixels | |
| nBytesPerPixel | bytes per pixel. |
| BOOL CDVCImage::Divide | ( | int | nConstant, | |
| double | dScaleResult | |||
| ) |
Divide and image by a constant and scale the result by a constant.
this(x,y) = this(x,y) / nConstant * dScaleResult
| nConstant | constant to divide each pixel by. | |
| dScaleResult | constant multiplier to scale the pixel by pixel result. |
| BOOL CDVCImage::Divide | ( | CDVCImage * | pDivisorImage, | |
| double | dScaleResult, | |||
| BOOL | bClipTo12Bits = FALSE | |||
| ) |
Divide and image by another image scaling the results by a constant and optionally clipping the returnined image between 0 and 4095.
this(x,y) /= pDivisorImage(x,y) * dScaleResult
| pDivisorImage | image divided into this image pixel by pixel. | |
| dScaleResult | constant multiplier to scale the pixel by pixel result. | |
| bClipTo12Bits | clips the output between 0 and 4095 if TRUE. |
| BOOL CDVCImage::DivideCopy | ( | CDVCImage * | pSrcImage, | |
| int | nConstant, | |||
| BOOL | bClipTo12Bits = FALSE | |||
| ) |
Divide a source image by a constant, and return the optionally clipped results.
this(x,y) = pSrcImage(x,y) / nConstant
| pSrcImage | numerator image. | |
| nConstant | constant denominator | |
| bClipTo12Bits | when TRUE clips the output between 0 and 4095. |
| int CDVCImage::GetBitsPerPixel | ( | ) |
Get the number of bits per pixel. Unlike the pDepth parameter in GetSize() which returns the number of bytes used for storage, this method returns the number of bits which may be 10, 12, 14 or 16 for an image with two bytes per pixel. Set in ReadCamera().
| BOOL CDVCImage::GetIndex | ( | int * | pIndex | ) |
Returns the image index of a multipage TIFF file.
| pIndex | returns the current zero based index or page. |
| BOOL CDVCImage::GetMetaData | ( | ImageMetaDataP | pMeta | ) |
Get or Copy the meta data from this image.
| pMeta | pointer to an ImageMetaData structure to copy from this image. |
| BOOL CDVCImage::GetRenderMethod | ( | dvcRenderControl_t * | pRenderOp | ) |
Get up an image's render method
| pRenderOp | structure sets the rendering method. |
| BOOL CDVCImage::GetSize | ( | int * | pWidth, | |
| int * | pHeight, | |||
| int * | pDepth | |||
| ) |
Returns the width and height of an image in pixels and depth in bytes per pixel.
| pWidth | returned with the image buffer's width | |
| pHeight | returned with the image buffer's height | |
| pDepth | returned with the image buffers's depth in bytes per pixel. |
| BOOL CDVCImage::GetSize | ( | PULONG | pWidth, | |
| PULONG | pHeight | |||
| ) |
Returns the width and height of an image in pixels.
| pWidth | returned with the image buffer's width | |
| pHeight | returned with the image buffer's height |
| ULONG CDVCImage::HistogramFreq | ( | ULONG | nBin | ) |
Get the frequency of a selected bin in the image's histogram.
| nBin | the DN frequency |
| BOOL CDVCImage::HistogramMask | ( | CDVCImage * | pMask, | |
| double * | pMean, | |||
| double * | pStdDev, | |||
| ULONG * | pMin, | |||
| ULONG * | pMax | |||
| ) |
Compute the histogram statistics using a second image as a mask for the pixels to be included.
| pMask | image with non-zero pixels used to include in the histogram | |
| pMean | returns the mean DN in the image. | |
| pStdDev | returns the standard deviation of DN in the image. | |
| pMin | returns the minimum DN in the image. | |
| pMax | returns the maximum DN in the image. |
| BOOL CDVCImage::HistogramStats | ( | double * | pMean, | |
| double * | pStdDev, | |||
| ULONG * | pMin, | |||
| ULONG * | pMax | |||
| ) |
Compute the histogram statistics of an image buffer.
| pMean | returns the mean DN in the image. | |
| pStdDev | returns the standard deviation of DN in the image. | |
| pMin | returns the minimum DN in the image. | |
| pMax | returns the maximum DN in the image. |
| int CDVCImage::Lock | ( | PVOID * | ppBuffer, | |
| PULONG | pWidth, | |||
| PULONG | pHeight, | |||
| PULONG | pDepth | |||
| ) |
Lock an image's resources returning a pointer to the image's pixel data.
| ppBuffer | returned with the pointer to the image data. | |
| pWidth | returned width. | |
| pHeight | returned height. | |
| pDepth | returned bytes per pixel. |
| BOOL CDVCImage::Multiply | ( | CDVCImage * | pMultiplierImage, | |
| double | dScaleResult | |||
| ) |
Multiply and image by another image scaling the result by a constant.
this(x,y) *= pMultiplierImage(x,y) * dScaleResult
| pMultiplierImage | image divided into this image pixel by pixel. | |
| dScaleResult | constant multiplier to scale the pixel by pixel result. |
| BOOL CDVCImage::Not | ( | int | nConstant | ) |
Negate a constant.
this(x,y) = ~nConstant
| nConstant | value negated and written to each pixel. |
| BOOL CDVCImage::Not | ( | CDVCImage * | pSrcImage | ) |
Negate an image.
this(x,y) = ~pSrcImage(x,y)
| pSrcImage | source image returned with each pixel negated. |
| BOOL CDVCImage::OpenFile | ( | LPSTR | szFileName | ) |
Open and read an image file. Supported file types are TIFF, JPEG and BMP.
| szFileName | file path and name of the image file to open. |
| CDVCImage & CDVCImage::operator *= | ( | double | k | ) |
multiply an image by a double precision constant
this(x,y) *= k
| k | constant to multiply this image. |
| CDVCImage & CDVCImage::operator *= | ( | int | k | ) |
multiply an image by an integer constant
this(x,y) *= k
| k | constant to multiply this image. |
Multiply two images
this(x,y) = this(x,y) * rMultiplyImage(x,y)
| rImg | image to mulitiply by this image, pixel by pixel. Overflows are clipped to the maximum DN this image depth supports. |
| CDVCImage & CDVCImage::operator+= | ( | int | k | ) |
Add a constant to an image
this(x,y) += k
| k | integer constant to add. Overflow is clipped to the maximum DN the depth supports. |
Add an image
this(x,y) += rAddImage(x,y)
| rImg | image to add. Must be the same dimension (width and height) as this image. Overflow is clipped to the maximum DN the depth supports. |
| CDVCImage & CDVCImage::operator-= | ( | int | k | ) |
Subtract a constant from an image
this(x,y) -= k
| k | integer constant to subtract. Underflow is clipped to 0. |
Subtract an image
this(x,y) -= rImg(x,y)
| rImg | is subtracted from the buffer, pixel by pixel. Must be the same dimension (width and height) as this image. Underflow is clipped to 0. |
| CDVCImage & CDVCImage::operator/= | ( | double | d | ) |
divide an image by a double precision constant
this(x,y) /= d
| d | constant to divide into this image. |
| CDVCImage & CDVCImage::operator/= | ( | int | k | ) |
divide an image by an integer constant
this(x,y) /= k
| k | constant to divide into this image. |
Divide an image by another image
this(x,y) = this(x,y) / rImg(x,y)
| rImg | is divided into this image, pixel by pixel. |
| CDVCImage & CDVCImage::operator= | ( | int | k | ) |
Fill this image with a constant
this(x,y) = k
| k | constant to fill an image with. |
Assignment operator
| rImg | source image copied to the new image. This image is modified to match the size and depth of rSourceImage. |
| BOOL CDVCImage::Or | ( | int | nConstant | ) |
Bitwise logical OR of an image and a constant.
this(x,y) |= nConstant
| nConstant | OR'd with each pixel. |
| BOOL CDVCImage::Or | ( | CDVCImage * | pSrcImage | ) |
Bitwise logical OR of two images.
this(x,y) |= pSrcImage(x,y)
| pSrcImage | source image for pixel by pixel OR operation. |
| BOOL CDVCImage::ReadCamera | ( | HANDLE | hDevice, | |
| ULONG | uLeft, | |||
| ULONG | uTop, | |||
| ULONG | uWidth, | |||
| ULONG | uHeight | |||
| ) |
Read a captured image from a DVC camera.
| hDevice | returned from dvcOpenCamera(). | |
| uLeft | first column in camera's readout area to return. | |
| uTop | first row in camera's readout area to return. | |
| uWidth | width in pixels to copy. | |
| uHeight | height in pixels to copy. |
| BOOL CDVCImage::ReadFile | ( | ) |
Copies or updates the image data in from an image file. Internally called by OpenFile() and SetIndex().
| BOOL CDVCImage::ReadPixel | ( | ULONG | x, | |
| ULONG | y, | |||
| PULONG | pPixData | |||
| ) |
Get the pixel data at a given x,y position.
| x | the horizontal or column pixel location | |
| y | the vertical or row pixel location | |
| pPixData | returns the DN at pixel x,y. |
| BOOL CDVCImage::ReadRect | ( | RECT * | pRect, | |
| PVOID | pPixData | |||
| ) |
Get the pixel data from a rectangular region within an image.
| pRect | pointer to a RECT struct with the area to return | |
| pPixData | returns the array of DN from pixel pRect->left, pRect->top to pRect->right, pRect->bottom. |
::ReadRoi( pRect->left, pRect->top, pRect->right - pRect->left, pRect->bottom - pRect->top, pPixData );
| BOOL CDVCImage::ReadRoi | ( | ULONG | x, | |
| ULONG | y, | |||
| ULONG | width, | |||
| ULONG | height, | |||
| PVOID | pPixData | |||
| ) |
Get the pixel data from a rectangular region within an image.
| x | the horizontal or column starting pixel location | |
| y | the vertical or row starting pixel location | |
| width | the number of columns to return | |
| height | the number of rows to return | |
| pPixData | returns the array of DN from pixel x,y to x+width,y+height |
| BOOL CDVCImage::ReadRow | ( | ULONG | x, | |
| ULONG | y, | |||
| ULONG | width, | |||
| PVOID | pPixData | |||
| ) |
Get the pixel data at a given row starting at x,y for width pixels.
| x | the horizontal or column starting pixel location | |
| y | the vertical or row starting pixel location | |
| width | the number of columns to return | |
| pPixData | returns the array of DN from pixel x,y to x+width,y |
| int CDVCImage::Release | ( | void | ) |
Release a locked image.
| BOOL CDVCImage::Render | ( | LPSTR | szFileName, | |
| RECT * | pSrcRect, | |||
| BYTE | bBitsPerPixel, | |||
| int | nAppend = 0 | |||
| ) |
Render an image to a file using the internal render method.
| szFileName | the path and name of the file to be written. | |
| pSrcRect | is the region to render or NULL if the entire image. | |
| bBitsPerPixel | number of bits per pixel to render. | |
| nAppend | is 0 to write a single image, 1 to append a multipage TIFF or 2 to append and close a multipage TIFF. |
DVC_FORMAT_RAW, default, saves as a TIFF format with the original data.
DVC_RENDER_TIFF saves a color TIFF format image file,
DVC_RENDER_BMP saves a color BMP format image file.
DVC_RENDER_JPG saves a color JPEG format image file.
In the later cases, the file type is automatically appended to the szFileName.
| BOOL CDVCImage::Render | ( | PVOID | pRGBBuffer, | |
| RECT * | pSrcRect, | |||
| ULONG | ulBytesPerLine, | |||
| BYTE | bBitsPerPixel, | |||
| ULONG | ulBufferLines = 0 | |||
| ) |
Render an image to a buffer using the internal render method.
| pRGBBuffer | destination buffer rendered. | |
| pSrcRect | optional region to be rendered or NULL if the full image. | |
| ulBytesPerLine | number of bytes per line in pRGBBuffer. | |
| bBitsPerPixel | number of bits per pixel to render. | |
| ulBufferLines | number of lines ( vertical dimension ) of pRGBBuffer. If ulBufferLines is 0, the height of the output buffer is assumed to be greater or equal the height of the pSrcRect or the current image buffer. |
| BOOL CDVCImage::ScaleLuts | ( | int | nRangeLow = -1, |
|
| int | nRangeHigh = -1 | |||
| ) |
Rescale the render luts to a given range.
| nRangeLow | DN equal or greater than outputs mapped to black | |
| nRangeHigh | DN equal or less than outputs mapped to white or full scale. |
| BOOL CDVCImage::SetIndex | ( | int | nIndex | ) |
Sets the image index of a multipage TIFF file and copies the image data.
| nIndex | the current zero based index or page. |
| BOOL CDVCImage::SetMetaData | ( | ImageMetaDataP | pMeta | ) |
Set or Copy the meta data to this image.
| pMeta | pointer to an ImageMetaData structure to copy to this image. |
| BOOL CDVCImage::SetRenderMethod | ( | dvcRenderControl_t * | pRenderOp | ) |
Set an image's render method
| pRenderOp | structure sets the rendering method. |
| BOOL CDVCImage::Subtract | ( | CDVCImage * | pSubImage, | |
| int | nOffset | |||
| ) |
subtract an image with an offset
this(x,y) -= pSubImage(x,y) + nOffset
| pSubImage | is subtracted from this image, pixel by pixel | |
| nOffset | is added to each pixel before returning. |
| BOOL CDVCImage::Subtract | ( | CDVCImage * | pSubImage | ) |
subtract an image.
this(x,y) -= pSubImage(x,y)
| pSubImage | is subtracted from this image, pixel by pixel |
| BOOL CDVCImage::SubtractDivide | ( | CDVCImage * | pFlatImage, | |
| CDVCImage * | pBkgImage, | |||
| double | dScaleResult, | |||
| BOOL | bClipTo12Bits = FALSE | |||
| ) |
Subtract a background image and divide by a flatfield, single pass Results are scaled by a constant dScaleResult and optionally clipped to a 12-bits (0-4095).
this(x,y) = ( this(x,y) - pBkgImage(x,y) ) / pFlatImage(x,y) * dScaleResult
Normally, dScaleResult is set to the mean DN of the pFlatImage image.
| pFlatImage | image to be divided into the source | |
| pBkgImage | image to be subtracted from the source | |
| dScaleResult | constant used to rescale the returned image. | |
| bClipTo12Bits | when TRUE returns the result clipped between 0 and 4095. |
| BOOL CDVCImage::Xor | ( | int | nConstant | ) |
Bitwise logical XOR of an image and a constant.
this(x,y) ^= nConstant
| nConstant | XOR'd with each pixel. |
| BOOL CDVCImage::Xor | ( | CDVCImage * | pSrcImage | ) |
Bitwise logical XOR of two images.
this(x,y) ^= pSrcImage(x,y)
| pSrcImage | source image for pixel by pixel XOR operation. |