📄 roi.h
字号:
* Returns the actual height in lines of the ROI. The same value can be
* directly accessed in the Height field
* @return The actual height in pixels of the image to be acquired; when used after
* ROI activation reports the image height actually set to the hardware;
* depending on the hardware capabilities and settings this value can be
* different from the image height previously set through the SetDimension()
* method.
* @sa SetDimension()
*/
U32BIT GetHeight(void) { return Height; }
/** Gets the X start position of the ROI inside the Target buffer.
* Returns the X start position of the ROI inside the actual target buffer; when
* used after ROI activation reports the image start position actually set to
* the hardware; depending on the hardware capabilities and settings this
* value can be different from the position previously set through the
* SetStartPosition() method.\n
* The same value can be directly accessed in the StartX field.
* @return The start position in pixels of the ROI inside the actual target buffer.
*/
U32BIT GetStartX(void) { return StartX; }
/** Gets the Y start position of the ROI inside the Target buffer.
* Returns the Y start position of the ROI inside the actual target buffer; when
* used after ROI activation reports the image start position actually set to
* the hardware; depending on the hardware capabilities and settings this
* value can be different from the position previously set through the
* SetStartPosition() method.\n
* The same value can be directly accessed in the StartY field.
* @return The start position in lines of the ROI inside the actual target buffer.
*/
U32BIT GetStartY(void) { return StartY; }
/** Gets the actual pixel depth for the ROI.
* This functions returns the pixel depth in bits for the actual ROI, including
* bits that are not used for color information (alpha channel).
* The same value can be directly accessed in the PxDepth field.
* The value in this field depends on the actual color format for the ROI.
* @return The actual pixel depth in bits for the ROI
* @sa GetColorBit()
*/
U16BIT GetPixelDepth(void) { return PxDepth; }
/** Gets the distance in bytes from one pixel to the next.
* This function returns the amount of bytes a pointer to the target buffer
* memory has to be incremented to point to the next pixel of the same line.
* The same value can be directly accessed in the PixelIncrement field.
* The value in this field depends on the actual color format for the ROI.
* @return The distance in bytes between two pixels in the same line.
* @sa SetColorFormat()
*/
U32BIT GetPixelIncrement(void) { return PixelIncrement; }
/** Gets the distance in bytes from one pixel to the same pixel in the
* next line.
* This function returns the amount of bytes a pointer to the target buffer
* memory has to be incremented to point to the same pixel of the next line.
* The same value can be directly accessed in the LineIncrement field.
* The value in this field depends on the actual color format for the ROI and
* the actual memory width
* @return The distance in bytes from one pixel to the same pixel in the next line.
* @sa SetColorFormat(), SetMemoryWidth()
*/
U32BIT GetLineIncrement(void) { return LineIncrement; }
/** Gets the height of the target buffer memory.
* This function returns the actual target buffer memory height in lines; that is
* how many lines of the actual memory width are available in the target
* buffer.\n
* This value depends on the actual color format for the ROI and the actual
* memory width and total size.\n
* @note under Windows NT and Windows 95, Daisy can be not able to
* determine the real amount of memory a VGA board has on-board;
* therefore the value returned by this function may be incorrect for WinVga
* target buffers.
* @return The height in lines of the target buffer memory
*/
U32BIT GetMemoryHeigth(void) { return MemoryInfo.Height; }
/** Gets the current color format for the ROI.
* Gets the current color format for the ROI
* @return The actual color format for the ROI. One of the @ref ROIColorFormat.
* @sa SetColorFormat()
*/
U8BIT GetColorFormat(void);
/** Gets the actual color resolution.
* This function returns the number of bits used for color information; the
* return value of this function can be used to determine the amount of colors
* that will be acquired.
* @return The number of bits in the pixel used to maintain color information,
* excluding the eventual alpha channel.
* @sa SetColorFormat(), GetColorFormat()
*/
U8BIT GetColorBit(void);
/** Gets the last error code for the ROI.
* Gets the last error code for the ROI
* @return The last error code for the ROI. One of the @ref ErrorDefinitions
*/
LVSTATUS GetStatus(void) { return UpdateInfo(); }
/** Determines if the ROI is properly initialized.
* Determines if the ROI is properly initialized
* @return TRUE if the ROI is initialized, otherwise FALSE.
*/
BOOL IsInitialized(void) { return Initialized; }
U32BIT GetArea(void);
/** Sets DIB mode for the ROI.
* Some Windows GDI functions can directly handle graphic images in form
* of bitmaps. This function allows the user application to acquire images
* from a camera directly in a Device Independent Bitmap format (DIB).
* Activating the DIB mode, force the LvROI to recalculate the hardware
* parameters in a way that the image is acquired directly in the DIB format,
* taking care of the required line padding.\n
* When the DIB mode is switched on, the LvROI object maintains a
* BITMAPINFO structure that reflects the actual parameters (dimension,
* color format, eventual palette) of the image being acquired. The user
* application can get a pointer to this structure by calling the
* GetBitmapInfo() method; this pointer can then be used in calls to
* Windows GDI functions such as SetDIBitsToDevice().
* \n
* Changing this parameter will affect the actual Memory Width, the Image
* Width and all the derived quantities.\n
* \n
* This mode has to be used for acquisition to a CPU target buffer, since an
* on-screen display of an image acquired in DIB format will generate screen
* corruption due to the different memory format of the video memory.\n
* \n
* Important: depending on the operating system, not all the formats are
* properly handled and recognized by the Windows GDI.
* Windows NT and Windows 95 recognize all the DIB formats.
* Windows 3.x can work only in 8, 15, or 24 bits.
* Daisy allows any format to be set independently from the actual operating
* system or screen color format.
* @param NewMode TRUE for activating the DIB mode
* acquisition; FALSE to switch to normal
* acquisition mode.
* @return The previous setting of the DIB mode.
*/
BOOL SetDIBMode(BOOL NewMode);
/** Gets the actual DIB mode for the ROI.
* Gets the actual DIB mode for the ROI
* @return The current DIB mode for the ROI. TRUE if the ROI is set to format the
* image data in DIB format otherwise FALSE;
* @sa SetDIBMode()
*/
BOOL GetDIBMode(void) { return IsDIB; }
/** Updates the BITMAPINFO of the ROI.
* This function is automatically called when changing ROI parameters
* through the Set... functions and the ROI is set to acquire in DIB mode.
* Whenever a user application is directly setting some of the ROI
* parameters and it is working in DIB mode, it should call this function to
* keep the internal BITMAPINFO structure aligned with the actual image
* parameters.
* @return @ref ErrorDefinitions
* @sa SetDIBMode()
*/
LVSTATUS UpdateDIB(void);
/** Gets a pointer to the BITMAPINFO structure internal to the ROI.
* When the DIB mode is set, this function returns the pointer to the internal
* BITMAPINFO structure reflecting the current image parameters.\n
* This pointer can be used in calls to the Windows GDI.\n
* When the DIB mode is not set, this function returns either NULL or the
* pointer to the internal BITMAPINFO structure, but its content is not
* updated to reflect the actual image parameters.
* @return pointer to the internal BITMAPINFO structure when the DIB mode is set
* otherwise it returns NULL or the pointer to the internal BITMAPINFO
* structure, but its content is not updated to reflect the actual image
* parameters.
* @sa SetDIBMode()
*/
LVROIBITMAPINFO GetBitmapInfo(void) { return bmi; }
/** Saves the actual image to a DIB file.
* This function transfers the actual content of the ROI to the file specified by
* the FileName parameter.\n
* Not all the DIB formats can be properly interpreted by graphic software,
* generally they are able to handle 8, 15, and 24 bit formats.\n
* Daisy allows any format to be saved; it is up to the user application to
* decide which.
* @param FileName Name of the file to which the ROI will save
* the bitmap. If the file exists, it is overwritten; if
* the file does not exist, it will be created. When
* a full path is specified, the path must exist.
* @return @ref ErrorDefinitions
* @sa SetDIBMode()
*/
LVSTATUS SaveDIB(LPSTR FileName);
LVSTATUS SaveLVRW(LPSTR FileName);
LVSTATUS LoadLVRW(LPSTR FileName, HANDLE *hMem);
LvROI &operator =(const LvROI &b) {
if (this==&b) {
return *this;
}
SetROIInfo((LvROIInfo *)&b);
return *this;
}
};
/** Retrieves the actual dimension of a ROI.
* Simply returns the size in bytes that the ROI occupies using the current
* ROI settings; this method is useful when the user application has to
* allocate buffers where to place the image in the ROI.
* @return The size in byte of the area the ROI occupies with the current settings.
* @sa LvGrabberNode::RetrieveROI(), LvGrabberNode::StoreROI()
*/
inline U32BIT LvROI::GetArea(void)
{
return (U32BIT)GetWidth()*GetHeight()*GetPixelIncrement();
}
#include <lvpackof.h>
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -