⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 roi.h

📁 相机传输图像程序源代码 拜耳模式(RAW格式文件)与RGB图像数据互相转换函数库
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef ___ROI_H
#define ___ROI_H

#include <dsylib.h>

#ifdef __UNIX__
typedef void * LVROIBITMAPINFO;
#else
typedef LPBITMAPINFO LVROIBITMAPINFO;
#endif

#include <lvpackon.h>

// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
/** Represents the Region Of Interest.
 * A Region Of Interest, also called ROI, is a rectangular part of video
 * memory formatted with a specific color coding, that can be different from
 * the actual output formatting, depending on the use the application wants to
 * do of this memory. For example, an incoming image is placed in a ROI
 * and also the output screen is a ROI.\n
 * The user application can retrieve from Daisy information about the ROI
 * currently active, those related with external equipment connected to the
 * grabber, so that it can access that part of memory interpreting in the right
 * way the data stored in it.\n
 * A ROI is defined by its position in the Video memory, by its dimensions
 * and by the color-coding used to generate it.\n
 * A user application can generate and use its own ROI, in order to store in
 * the Video Memory application related data.\n
 * \n
 * A ROI is defined in the system by the @ref LvROIInfo structure. Since exists a
 * strict relationship among the content of its fields, Daisy provides the
 * LvROI class that can be used by the application to manage the
 * @ref LvROIInfo data in order to be sure that the content of their fields is
 * coherent.\n
 * All the @ref LvROIInfo attributes remain 'public', so that the reading access to
 * them can be a little bit faster, but the user application is strongly
 * recommended to use the methods provided by LvROI to set those
 * attributes in order to have them coherent.\n
 * On creation, the content of the LvROI object is filled with the actual
 * settings of the VGA.
 */  
LVDSYCLASS LvROI : public _tagLvROIInfo {
    private:

    protected:
        BOOL Initialized;
        BOOL Error;

        // BOOL IsDIB;        Moved to @ref LvROIInfo struct
        LVROIBITMAPINFO bmi;

        LVSTATUS RoiStatus;

        LVSTATUS UpdateInfo(void);
        LVSTATUS CheckInfo(void);
        LVSTATUS CheckBoundaries(void);

        /** @sa LvGrabberNode::LvGrabberNode() */
        friend class LvGrabberNode;

    public:

        LvROI(void);
        LvROI(LvROI &Info);
        ~LvROI(void);

        /** Sets the content of the ROI.
         * Initializes the content of the actual ROI by copying the content of the
         * provided (and already initialized) ROI
         * @param Info   The @ref LvROIInfo to copy the new content from.
         */
        void SetROIInfo(LvROIInfo *Info);
        
        /** Sets the memory width for the ROI.
         * This function allows the user to define the memory width that has to be
         * considered when calculating the parameters for the image transfer.
         * Modifying this parameter affects the distance in the memory between two
         * consecutive fields.
         * @note  Other ROI members, such as LineIncrement, are updated when calling
         *        this function.         
         * @param  MemWidth         size in pixels of the memory. This parameter
         *                          is independent on the actual color format.
         * @return @ref ErrorDefinitions
         * @sa SetHResolution()
         */
        LVSTATUS SetMemoryWidth(U16BIT MemWidth);
        
        /* Sets the memory width for the ROI.
         * This function allows the user to define the memory width that has to be
         * considered when calculating the parameters for the image transfer.
         * It behaves the same as the SetMemoryWidth() function but takes
         * definitions of type @ref ROIHRes. These definitions reflect common settings for
         * VGA boards.
         * @param HRes Horizontal resolution. One of the @ref ROIHRes definitions.
         * @return @ref ErrorDefinitions
         * @sa SetMemoryWidth()
         */
        LVSTATUS SetHResolution(U8BIT HRes);
        
        /** Sets the color format for the ROI.
         * This function allows the user to specify the color format with which the
         * image will be acquired in the ROI. This parameter affects the address
         * calculation for the image fields.\n
         * @note The hardware can be not able to transfer the required color format;
         *       in this case an error will be reported when the ROI is activated.
         * @param Format One of the @ref ROIColorFormat
         * @return @ref ErrorDefinitions
         */
        LVSTATUS SetColorFormat(U8BIT Format);
        
        /** Sets the dimension for the ROI.
         * This function allows the user to specify the dimensions of the image that
         * will be acquired in the current color format.
         * @note not all the possible dimensions are allowed by the hardware;
         *       when the ROI is activated, its Width and Height fields are updated by
         *       Daisy with the dimensions actually set on the hardware. Applications
         *       should always check these fields in order to properly handle on screen
         *       display or processing.
         * @param aWidth   Width in pixels of the image
         * @param aHeight  Height in lines of the image
         * @return @ref ErrorDefinitions
         */
        LVSTATUS SetDimension(U32BIT aWidth, U32BIT aHeight);
        
        /** Sets the start position of the ROI inside the target buffer.
         * This function allows the user to specify the start of the image inside the
         * chosen target buffer; the X and Y parameters of the first form are
         * expressed respectively in pixels and lines.\n
         * The start of the target buffer is considered to be at coordinates <0,0>.
         * The start position is dependent on the actual settings for the Memory
         * Width and color format.
         * @note               when working with a progressive camera this
         *                     setting has no influence on the hardware
         *                     settings.
         * @param     X                  X position in pixels of the image to be acquired
         * @param     Y                  Y position in lines of the image to be acquired
         * @param     DifferentFieldAddress    Defines if the two fields have to be placed in
         *                                     positions different from the default
         *                                     (interleaved).
         * @param     X1                 When DifferentFieldAddress is TRUE,
         *                               it specifies the X position of the second field,
         *                               otherwise it is ignored
         * @param     Y1                 When DifferentFieldAddress is TRUE,
         *                               it specifies the Y position of the second field,
         *                               otherwise it is ignored
         * @return @ref ErrorDefinitions
         * @sa SetMemoryWidth(), SetColorFormat()
         */
        LVSTATUS SetStartPosition(U32BIT X, U32BIT Y, U8BIT DifferentFieldAddress=0, U32BIT X1=0, U32BIT Y1=0);
        
        /* Sets the start position of the ROI inside the target buffer.
         * This function allows the user to specify the start of the image inside the
         * chosen target buffer; the X and Y parameters of the first form are
         * expressed respectively in pixels and lines.\n
         * The start of the target buffer is considered to be at coordinates <0,0>.
         * The start position is dependent on the actual settings for the Memory
         * Width and color format.
         * @note Under Windows NT and Windows 95 Daisy could be not able to properly
         *       recognize the size of a VGA on board memory, so this function could
         *       place the image in the wrong position.
         * @param Mode                  One of the @ref ROIStartPosition definitions.
         * @return @ref ErrorDefinitions
         * @sa SetMemoryWidth(), SetColorFormat()
         */
        LVSTATUS SetStartPosition(U8BIT Mode);
        
        /** Set Lock mask properties for the ROI.
         * Sets the lock mask to be used by the grabber.
         * @param NewLockMask pointer to a CPU memory block where the
         *                    ROI will get the actual Lock mask content
         *                    from; this pointer must remain valid for all the
         *                    time the lock mask is used.
         * @param Enable      flag indicating if the lock mask has to be
         *                    immediately used
         * @param Invert      instructs Daisy to invert the order of the
         *                    bitmap lines when transferring the lock mask;
         *                    this is useful when using bitmaps from .BMP
         *                    files
         * @return @ref ErrorDefinitions
         */
        LVSTATUS SetLockMask(U8BIT FAR *NewLockMask, BOOL Enable=TRUE, BOOL Invert=FALSE);
        
        /** Sets the destination buffer for the ROI.
         * Specifies which target buffer the ROI will be transferred to.
         * In order to have proper information about the target buffer, such as the
         * base address of its memory, the ROI must be activated through a call to
         * the LvGrabbeNode::ActivateROI() function.
         * @param TargetBufferId                  one of the TargetBuffer value.
         * @return @ref ErrorDefinitions
         * @sa LvGrabberNode::ActivateROI()
         */
        LVSTATUS SetTargetBuffer(U16BIT TargetBufferId);
        
        /** Sets acquisition flags for the ROI.
         * This function allows the user to specify flags that could affect the way
         * Daisy sets the hardware.\n
         * Until now the only flag that has an effect on the hardware settings is
         * AcqMode_ClipWinColors, which instructs Daisy to clip the Windows
         * colors while transferring the image. This flag should be used to acquire
         * images that will be transferred directly or indirectly to the Windows screen
         * when this is set to 256 colors.
         * @param AcqMode : One of the @link ROIAcqMode ROIAcqMode definitions@endlink
         * @return @ref ErrorDefinitions
         * @sa SetColorFormat(), LvGrabberNode::GetConnectionInfo()
         */
        LVSTATUS SetAcquisitionMode(U16BIT AcqMode);


        /** Gets the actual width of the ROI.
         * Returns the actual width in pixels of the ROI. The same value can be
         * directly accessed in the Width field
         * @return The actual Width in pixels of the image to be acquired; when used after
         *         ROI activation reports the image width actually set to the hardware;
         *         depending on the hardware capabilities and settings this value can be
         *         different from the image width previously set through the SetDimension
         *         method.
         * @sa SetDimension()
         */
        U32BIT GetWidth(void) { return Width; }
        
        /** Gets the actual height of the ROI.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -