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

📄 dsylib.h

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

#include <cls_def.h>
#include <dsydef.h>
#include <prvphlib.h>
#include <lvcamdef.h>

#include <lvpackon.h>
#include <dsyver.h>

LVDSYCLASS LvGrabberNode;
LVDSYCLASS LvCameraNode;
LVDSYCLASS LvWatchDogTimer;

LVDSYCLASS DsyApp_Seq32;
LVDSYCLASS DsyApp_Seq32_Enhanced;
LVDSYCLASS DsyApp_Seq_Flash;
LVDSYCLASS DsyApp_Seq_AsyncReset;
LVDSYCLASS DsyApp_Seq_FrameIntegration;
LVDSYCLASS DsyApp_Seq_FIMAR;

typedef struct _tagLvCeSignalInterface LvCeSignalInterface;

/** Information about connectors */
typedef struct _LVEXPSTRUCT _tagLvConnectionInfo {
    /** Description of the connector; referred to the physical aspect of the connector. */
    char Description[Max_DescStrLength*3+3];
    /*? Type of connector (one of the @ref ConnectorId definitions). */
    U8BIT Type;
    /** Connector index for the specified Video type. */
    U8BIT Index;
    /** Type of video (one of the \b VideoTypeId definitions). */
    U8BIT VideoType;
    /** Handle of the connector; see ConnectCamera(). */
    HCONNECTOR hConn;
    /** Synchronization signal to be used. */
    U16BIT SyncNr;
    /** Subgrabber index the connector connects to. */
    U8BIT SubGrbNr;
    /** Status of the connector (free / usable). */
    U32BIT Status;
    } LvConnectionInfo;


/** Information about target buffer memory */
typedef struct _LVEXPSTRUCT _tagLvMemInfo {
    /** Size in bytes of the target buffer. */
    U32BIT Size;
    /** Logical memory width in pixel. */
    U32BIT Width;
    /** Logical memory height in pixel. */
    U32BIT Height;
    /*? Actual pixel depth. */
    U8BIT  PxDepth;
    /** Actual base address for the target buffer. */
    char _Huge_ *BaseAddress;
    /** Actual base address for the target buffer. */
    char _Huge_ *BaseAddress1;
    /** Actual base address for the target buffer. */
    char _Huge_ *BaseAddress2;
    /** Target buffer identifier (one of the @ref TargetBuffer definitions). */
    U16BIT TargetBufferId;
    } LvMemInfo;

/*? Information about video memory */
typedef struct _LVEXPSTRUCT _tagLvCPUWindow {
    U16BIT StartX[Max_ColorComponent];     /*? Start X. */
    U16BIT StartY[Max_ColorComponent];     /*? Start Y. */
    U16BIT Width[Max_ColorComponent];      /*? Defined width. */
    U16BIT Height[Max_ColorComponent];     /*? Defined height. */
    } LvCPUWindow;


/*? Lock mask info */
typedef struct _LVEXPSTRUCT _tagLvLockMask {
    U8BIT _Huge_ *Bits;    /*? Pointer to the CPU memory from where the lock mask is updated. */
    U8BIT Enable;          /*? Defines if the Lock mask is currently enabled. */
    U8BIT Invert;          /*? Defines if the Lock mask lines have to be inverted on transfer. */
    } LvLockMask;

/** Information structure for ROI */
typedef struct _LVEXPSTRUCT _tagLvROIInfo {
    /** Horizontal size of the ROI in pixels. */
    U32BIT Width;
    /** Vertical size of the ROI in pixels. */
    U32BIT Height;
    /** X position in the memory of the ROI in pixels. */
    U32BIT StartX;
    /** Y position in the memory of the ROI in pixels. */
    U32BIT StartY;
    /** Enables the possibility to address each field separately.
     * Enables the possibility to address each field separately; the start position
     * for the second field is given by the following @ref StartX1, @ref StartY1 field
     */
    U8BIT  X1Y1Enable;
    /** X position in the memory of the second field in pixels.
     * X position in the memory of the second field in pixels; active if
     * @ref X1Y1Enable is @b TRUE
     */
    U32BIT StartX1;
    /** Y position in the memory of the second field in pixels.
     * Y position in the memory of the second field in pixels; active if
     * @ref X1Y1Enable is @b TRUE
     */
    U32BIT StartY1;
    /** Actual start address of the ROI. */
    U32BIT StartAddress;
    /** The Packing unit of a pixel in the ROI.
     * The Packing unit of a pixel in the ROI, excluding unused bits. Measure
     * unit: bits.
     */
    U8BIT  PxDepth;
    /** Number of color component for the current ROI color format. */
    U8BIT  NrColorComponent;
    /** Determines how many bits are used for each color component. */
    U8BIT  BitPerColor[Max_ColorComponent];
    /*? Names each color component with its standard name so the application
     * can distinguish between them. 
     * Possible values are those in ColorComponent group.
     */
    U8BIT  ColorPerComponent[Max_ColorComponent];
    /** The amount of bytes to be read/written to have the same sequence of color component. 
     * It depends on the desired pixel depth.
     */
    U8BIT  PackingSequence;
    U8BIT  PossibleAccess;
    /** Number of bytes the user has to add to a pointer addressing a part of
     *  video memory in order to address the next pixel.
     */
    U8BIT  PixelIncrement;
    /** Number of bytes the user has to add to a pointer addressing a part of
     *  video memory in order to address the next row at the same X position.
     */
    U32BIT LineIncrement;
    /*? Color component to be retrieved.
     * Color component to be retrieved; the functionality of this setting depends
     * on the hardware. Possible values are those in @ref ColorComponent group.
     */
    U8BIT  ComponentSelection;
    /** Masks the retrieving of color component.
     * Masks the retrieving of color component; the functionality of this setting
     * depends on the hardware. Possible values @b 0 or  @b 1
     */
    U8BIT  AccessMask[Max_ColorComponent];
    /** Specify a mode of addressing to be used accessing the video memory.
     * Specify a mode of addressing to be used accessing the video memory; the
     * functionality of this setting depends on the hardware. Possible values are
     * those in @ref AddressMode group.
     */
    U8BIT  AddressMode;
    /** This flag instructs @a Daisy to prepare the hardware to acquire images that
     *  will be displayed on screen.
     * This flag instructs @a Daisy to prepare the hardware to acquire images that
     * will be displayed on screen; note that the settings in this field are
     * independent from the actual settings in the @a TargetBufferId field. The use of
     * this flag by @a Daisy depends on the actual hardware capabilities and the
     * actual system settings.
     */
    U16BIT  AcquisitionMode;
    /*? If the @ref AddressMode item is set to AddrMode_Window, the @ref LvCPUWindow
     *  structure maintains the dimension and position of the current @a 'window'.
     */
    LvCPUWindow CPUWindow;
    /** Describes the current view of the video memory. */
    LvMemInfo MemoryInfo;
    /*? Lock mask definition for the current ROI. */
    LvLockMask LockMask;
    /** Value which represents if this image is @b Windows @b DIB or not. 
     * @b TRUE if the image format represents a @b Windows @b DIB. 
     * The methods and data related to the @b DIB mode are still in the @ref LvROI class.
     */
    BOOL IsDIB;
    /** Internally used by Daisy. */
    U16BIT Reserved[10];
    } LvROIInfo;

/** Information structure for Target Buffers */
typedef struct _tagLvTgtBufferInfo {
    LVRAWPTR      Physical;          /**< Physical address of the buffer. */
    LVRAWPTR      Linear;            /**< Linear address of the buffer. */
    unsigned long Size;              /**< Size in bytes of the buffer. */
    BOOL          IsContiguos;       /**< /b TRUE if the buffer is physically contiguous. */
    U8BIT _Huge_ *X86;               /**< X86 address of the buffer. */
    } LvTgtBufferInfo;

/** Data for camera connection.
 * This data could be acquired by calling function DsyCamConnectInfoDlg() and this data could
 * be used directly in function LvGrabberNode::ConnectCamera() (which connects camera to grabber)
 * @code
 *   LvCameraConnDlgInfo Info;
 *   // ...
 *   if (DsyCamConnectInfoDlg(MainWnd, &Info)==IDOK)
 *   {
 *     hCamera = Info.Grabber->ConnectCamera(Info.CameraType,
 *                                           Info.hConn,
 *                                           Info.SyncNr);
 *   }
 *   // ...  
 * @endcode  
 */
typedef struct _tagLvCameraConnDlgInfo {
    LvGrabberNode *Grabber;        /**< Pointer to the selected grabber node. */
    HGRABBER hGrabber;             /**< Handle of the selected grabber. */
    U16BIT CameraType;             /**< Selected camera type. */
    HCONNECTOR hConn;              /**< Selected connector. */
    U8BIT SyncNr;                  /**< Selected synchronization. */
    } LvCameraConnDlgInfo;



typedef struct _tagLvCameraConnDlgInfoUser {
//[CLASS/OEM/STRUCT] LvCameraConnDlgInfoUser
// Data for DsyCamConnectInfoDlgUser
//+
//[DATA!/public/OEM]
    LvCameraConnDlgInfo Info;
    // ...
    BOOL UserCameraOnly;
    // ...
    BOOL UseExternalDialog;
    // ...
    HINSTANCE hModule;
    // ...
    LPSTR DialogId;
    // ...
    DLGPROC DialogProc;
    // ...
//.
//-[CLASS] LvCameraConnDlgInfoUser

    } LvCameraConnDlgInfoUser;

/** Information about acquired images */
typedef struct _tagLvAcquiredImageInfo {
    U32BIT    AcquiredWidth;        /**< Width in pixels of the acquired image. */
    U32BIT    AcquiredHeight;       /**< Height in lines of the acquired image. */
    /** Frame ID.
     * FrameId contains a 32-Bit Counter which is incremented directly on the
     * video input of the camera and loops on overflow to 1. If the FrameId is equal to 0
     * it means an invalid id.
     */
    U32BIT    FrameId;
    /** Timestamp.
     * Timestamp contains a clock counter which is taken at trigger time out of
     * a 13.5 MHz time counter. The clock counter has a size of 31 bit and
     * therefore loops to 0 on overflow after about ~160 sec. This counter can
     * currently not be reseted.
     */
    U32BIT    Timestamp;

    /** Various flags defining properties of the acquired image.
     * A combination of @ref ImageInfoFlag definitions.
     */
    U32BIT    Flags;
    LvROIInfo ROI;                  /**< ROI - Region Of Interest. */
    LVRAWPTR  Internal[4];
    LVRAWPTR  Reserved[4];
    } LvAcquiredImageInfo;


typedef struct _tagLvFMBInfo {
    U16BIT    FrameDelay;
    U16BIT    FMBFrame;
    U32BIT    FreePerc;
    LVRAWPTR  Internal[2];
    LVRAWPTR  Reserved[4];
    } LvFMBInfo;


/** The LvImgProcessParam structure holds parameters for all the preprocessing functions.
 * The structure contains additional substructures, one dedicated for every preprocessing function.
 */
typedef struct _tagLvImgProcessParam {

    /** The \b BayerDecoding structure holds parameters for Bayer decoder (its color output).
     * Bayer decoding is always switched on automatically on the hardware that supports it (the ?RTF?
     * models) for Bayer encoded cameras.\n
     * It is intended especially for situations, when the default algorithm does not provide desired 
     * color output (e.g. because ambient illumination in the scene or improper color behavior of 
     * the camera) and needs white balancing. To switch the white balance function on, set the \b Mode field 
     * of this structure to \b LvImgProcess_Enable (possibly OR-ed with other flags, see LvImgProcessParam::_BayerDecoding for details). 
     * Otherwise the Bayer decoding algorithm will run without additional white balancing.\n
     * \n
     * For details and parameters see LvImgProcessParam::_BayerDecoding
     * @sa LvImgProcessParam::_BayerDecoding, LvImgProcessParam::_ColorCorrection, LvImgProcessParam::_ShadingCorrection
     */
    struct _BayerDecoding {
        /** Holds informations about what parameters have to be used for Bayer decoding.
         * All of values could be OR-ed.
         * - LvImgProcess::LvImgProcess_Enable enables bayer decoding
         * - LvImgProcess::LvImgProcess_WhiteIsCoeff Enables using the global weights.
         * - LvImgProcess::LvImgProcess_WhiteIsROI enable white reference image (fill path to white image in \a WhiteImage member)
         * - LvImgProcess::LvImgProcess_BlackIsROI enable black reference image (fill path to black image in \a BlackImage member)
         * - ...
         * @note Bayer decoding \b is switched on automatically.
         */ 
        U32BIT    Mode;
        U32BIT    ThresholdFactor;

        /** white image reference data (or path to file with this data). */
        void     *WhiteImage;
        /** black image reference data (or path to file with this data). */
        void     *BlackImage;
        /** current state */
        LVSTATUS  Status;
        /** Reserved. Usable for example to enter global weights (Reserved[0] holds red weight, 
         *                                  Reserved[1] green weight and Reserved[2] the blue one)
         */
        U32BIT    Reserved[3];
        } BayerDecoding;

    /** Structure for setting and enabling shading correction preprocessing.
     * Shading correction can compensate for non-uniformity in image brightness (and color), for example
     * to fix problems with non-uniform illumination of the acquired scene. The compensation is done
     * on a per-pixel basis.\n
     * \n
     * For details and parameters see LvImgProcessParam::_ShadingCorrection
     * @warning You cannot use shading correction and bayer decoding functionality at the same time.
     * @note Shading correction functionality \b cannot be updated at runtime (using LvExtDeviceNode::UpdateImageProcessParam()
     *       function)
     * @sa LvImgProcessParam::_ShadingCorrection, LvImgProcessParam::_BayerDecoding, LvImgProcessParam::_ColorCorrection
     */
    struct _ShadingCorrection {
        /** Holds informations about what parameters have to be used for shading correction. 
         * There is very similar functionality like Bayer decoding is, except of if 
         * mode doesn't contain \b LvImgProcess_Enable so shading correction will not be processed
         * @note Shading correction \b isn't switched on automatically.
         */
        U32BIT    Mode;
        /** white image reference (or path to file with this data). */
        void     *WhiteImage;
        /** black image reference (or path to file with this data). */
        void     *BlackImage;
        /** current state. */
        LVSTATUS  Status;
        /** reserved. */
        U32BIT    Reserved[4];
        } ShadingCorrection;

    /** Structure for setting and enabling color correction preprocessing.
     * Color correction can globally change the colors in the image using a 3

⌨️ 快捷键说明

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