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

📄 lvcamdef.h

📁 相机传输图像程序源代码 拜耳模式(RAW格式文件)与RGB图像数据互相转换函数库
💻 H
📖 第 1 页 / 共 2 页
字号:
     *   2.n, ..., 2.2, 2.1, 1.n, ..., 1.2, 1.1, 3.1, 3.2, ..., 3.n, 4.1, 4.2, ..., 4.n
     * @endcode
     */
    Scn_4tap_QuarterLineDiverge_NI,       // 34
    /** Quarter-line diverging, 4 taps, 1 line, Interlaced.
     * @code
     *   2.n, ..., 2.2, 2.1, 1.n, ..., 1.2, 1.1, 3.1, 3.2, ..., 3.n, 4.1, 4.2, ..., 4.n
     * @endcode
     */
    Scn_4tap_QuarterLineDiverge_I,        // 35
    /* internal */
    Scn_Last,
    /* internal */
    Scn_Private_First,
    /* internal */
    Scn_4tap_8_OddEven=Scn_Private_First,
    /* internal */
    Scn_Private_Last
    };

enum _TapScanMode {
    TapScan_ToBeDefined,

    TapScan_2Line,
    TapScan_1Line,
    TapScan_HalfLine,
    TapScan_HalfLineReverse,
    TapScan_2HalfLine,
    TapScan_2HalfLineReverse,
    TapScan_4Line,
    TapScan_QuarterLine,
    TapScan_QuarterLineReverse,
    TapScan_HalfLineDiverge,
    TapScan_2HalfLineDiverge,
    TapScan_QuarterLineDiverge,

    TapScan_Last
    };


#define Scn_ParallelField  Scn_ParallelField_NI

/*? @defgroup CameraSignalImpedance Camera signals definitions for line impedance */
//?@{
/*? Impedance is 0 ohm */
#define SImp_0             0x00
/*? Impedance is 50 ohm */
#define SImp_50            0x01
/*? Impedance is 75 ohm */
#define SImp_75            0x02
/*? Impedance is 1k ohm */
#define SImp_1k            0x03
/*? Impedance is 8k ohm or RS422 */
#define SImp_8k            0x04
/*? Impedance is conform to TTL */
#define SImp_TTL           0x05
//?@}



// Obsolete
typedef struct _LVEXPSTRUCT _tagLvCameraSync {
    U8BIT Mode;
    float CHIn;
    float VIn;
    U8BIT VCountHold;
    } LvCameraSync;

/** External device Region of interest. */
typedef struct _LVEXPSTRUCT _tagLvExtDeviceInfo {
    /** X origin of the device Roi relative to Horizontal Blank End (HBE). */
    U16BIT StartX;
    /** Y origin of the device Roi relative to Vertical Blank End (VBE). */
    U16BIT StartY;
    /** Width of the device Roi. */
    U16BIT Width;
    /** Height of the device Roi. */
    U16BIT Height;
    /** Maximum width the device Roi can assume (difference between HBS and HBE). */
    U16BIT MaxWidth;
    /** Maximum height the device Roi can assume (difference between VBS and VBE). */
    U16BIT MaxHeight;
    } LvExtDeviceInfo;


/** Camera Region of interest (placeholder for @ref LvExtDeviceInfo). */
typedef LvExtDeviceInfo LvSourceInfo;

/** Monitor Region of interest (placeholder for @ref LvExtDeviceInfo) */
typedef LvExtDeviceInfo LvMonitorROIInfo;

/** Camera signal definition. */
typedef struct _LVEXPSTRUCT _tagLvCameraSignal {
    /** Indicates if the signal is enabled. */
    U8BIT  Enabled _BYTEALIGNED;
    /** Indicates if the signal is an output or an input from the camera point of view. 
     * It can assume one of the \b CameraSignalIO values.
     */
    U8BIT  InOut _BYTEALIGNED;
    /** Specifies the signal impedance.
     * It can assume one of the \b CameraSignalImpedance values.
     */
    S16BIT Impedance _BYTEALIGNED;
    /** Specifies the upper level in mV of the signal. */
    float  UpperLevel _BYTEALIGNED;
    /** Specifies the lower level in mV of the signal. */
    float  LowerLevel _BYTEALIGNED;
    /** Specifies the polarity of the signal.
     * It can assume one of the \b CameraSignalPolarity values.
     */
    U8BIT  Polarity _BYTEALIGNED;
    /** Specifies the signal line type. */
    U8BIT  LineType _BYTEALIGNED;
    } LvCameraSignal;


/** Timing data for cameras */
typedef struct _LVEXPSTRUCT _tagLvCameraTiming {
    /** Type of timing. */
    U16BIT Type _BYTEALIGNED;
    /** Horizontal Line Length. */
    float  Hll _BYTEALIGNED;
    /** Horizontal Sync Width. */
    float  Hsw _BYTEALIGNED;
    /** Horizontal Blank End */
    float  Hbe _BYTEALIGNED;
    /** Horizontal Blank Start */
    float  Hbs _BYTEALIGNED;
    /** Horizontal delay */
    float  HDly _BYTEALIGNED;
    /** Fields Per Frame */
    U8BIT  Fpf _BYTEALIGNED;
    /** Lines Per Frame */
    U16BIT Lpf _BYTEALIGNED;
    /** Vertical Sync Width */
    U16BIT Vsw _BYTEALIGNED;
    /** Vertical Blank End */
    U16BIT Vbe _BYTEALIGNED;
    /** Vertical Blank Start */
    U16BIT Vbs _BYTEALIGNED;
    /** Vertical delay */
    U16BIT VDly _BYTEALIGNED;
    } LvCameraTiming;


/** Information data for cameras */
typedef struct _LVEXPSTRUCT _tagLvCameraInfo {
    /** Camera description */
    char Name[Max_CamDescStrLength] _BYTEALIGNED;
    /** Camera identifier. */
    U16BIT Id _BYTEALIGNED;
    /** Internal use */
    U8BIT Reserved[2] _BYTEALIGNED;
    /** LvCameraTiming timing parameters */
    LvCameraTiming Timing _BYTEALIGNED;
    /** LvCameraSignal signals definition */
    LvCameraSignal Signal[CSig_Last] _BYTEALIGNED;
    /** Type of camera; one of the \b VideoTypeId values */
    U8BIT VideoType _BYTEALIGNED;
    /* Analog Color coding; one of the /b AnalogColorCoding values */
    U8BIT ColorCoding _BYTEALIGNED;
    /** Aspect ratio component: Horizontal */
    float ArH _BYTEALIGNED;
    /** Aspect ratio component: Vertical */
    float ArV _BYTEALIGNED;
    /** Sampling clock rate */
    float Smp _BYTEALIGNED;
    /** Pixel aperture ratio */
    float Alfa _BYTEALIGNED;
    /** Aspect Ratio deviation */
    float Ard _BYTEALIGNED;
    /** Scanning mode; one of the ScanModeId values */
    U8BIT ScanMode _BYTEALIGNED;
    } LvCameraInfo;


/** @defgroup LvCamInfo Group of macros to determine several features about LvCameraInfo structure.
 */
//@{
#define LvCamInfo_IsDigital(x) ((x)->Signal[CSig_AVideo].Enabled==0 && (x)->Signal[CSig_DVideo].Enabled)
#define LvCamInfo_IsDigitalD(x) (LvCamInfo_IsDigital(x) && ((x)->Reserved[0]==Dvs_BW_2x8 ||\
                                                            (x)->Reserved[0]==Dvs_BW_2x10 ||\
                                                            (x)->Reserved[0]==Dvs_BW_2x14 ||\
                                                            (x)->Reserved[0]==Dvs_BW_2x16 ||\
                                                            (x)->Reserved[0]==Dvs_BW_2x12))
#define LvCamInfo_IsDigitalQ(x) (LvCamInfo_IsDigital(x) && ((x)->Reserved[0]==Dvs_BW_4x8 ||\
                                                            (x)->Reserved[0]==Dvs_BW_4x10 ||\
                                                            (x)->Reserved[0]==Dvs_BW_4x14 ||\
                                                            (x)->Reserved[0]==Dvs_BW_4x16 ||\
                                                            (x)->Reserved[0]==Dvs_BW_4x12))



#define LvCamInfo_HFactorScan2(x) \
                              ((x)==Scn_ParallelPixel_NI              || \
                               (x)==Scn_2ForwardPixel_NI              || \
                               (x)==Scn_2ConvergingPixel_NI           || \
                               (x)==Scn_2DivergingPixel_NI            || \
                               (x)==Scn_4tap_2Line_NI                 || \
                               (x)==Scn_4tap_2HalfLine_NI             || \
                               (x)==Scn_4tap_2HalfLineReverse_NI      || \
                               (x)==Scn_4tap_2HalfLineDiverge_NI      || \
                                0)


#define LvCamInfo_HFactor2(x) LvCamInfo_HFactorScan2((x)->ScanMode)

/*
#define LvCamInfo_HFactor2(x) ((x)->ScanMode==Scn_ParallelPixel_NI              || \
                               (x)->ScanMode==Scn_2ForwardPixel_NI              || \
                               (x)->ScanMode==Scn_2ConvergingPixel_NI           || \
                               (x)->ScanMode==Scn_2DivergingPixel_NI            || \
                               (x)->ScanMode==Scn_4tap_2Line_NI                 || \
                               (x)->ScanMode==Scn_4tap_2HalfLine_NI             || \
                               (x)->ScanMode==Scn_4tap_2HalfLineReverse_NI      || \
                               (x)->ScanMode==Scn_4tap_2HalfLineDiverge_NI      || \
                                0)
*/

#define LvCamInfo_HFactorScan4(x) \
                              ((x)==Scn_4tap_1Line_NI                 || \
                               (x)==Scn_4tap_HalfLine_NI              || \
                               (x)==Scn_4tap_HalfLineReverse_NI       || \
                               (x)==Scn_4tap_QuarterLine_NI           || \
                               (x)==Scn_4tap_QuarterLineReverse_NI    || \
                               (x)==Scn_4tap_QuarterLineDiverge_NI    || \
                               (x)==Scn_4tap_HalfLineDiverge_NI       || \
                                0)

#define LvCamInfo_HFactor4(x) LvCamInfo_HFactorScan4((x)->ScanMode)
/*
#define LvCamInfo_HFactor4(x) ((x)->ScanMode==Scn_4tap_1Line_NI                 || \
                               (x)->ScanMode==Scn_4tap_HalfLine_NI              || \
                               (x)->ScanMode==Scn_4tap_HalfLineReverse_NI       || \
                               (x)->ScanMode==Scn_4tap_QuarterLine_NI           || \
                               (x)->ScanMode==Scn_4tap_QuarterLineReverse_NI    || \
                               (x)->ScanMode==Scn_4tap_QuarterLineDiverge_NI    || \
                               (x)->ScanMode==Scn_4tap_HalfLineDiverge_NI       || \
                                0)
*/

#define LvCamInfo_VFactorScan2(x) \
                              ((x)==Scn_ParallelField_NI              || \
                               (x)==Scn_4tap_2Line_NI                 || \
                               (x)==Scn_4tap_2HalfLine_NI             || \
                               (x)==Scn_4tap_2HalfLineReverse_NI      || \
                               (x)==Scn_4tap_2HalfLineDiverge_NI      || \
                                0)

#define LvCamInfo_VFactor2(x) LvCamInfo_VFactorScan2((x)->ScanMode)
/*
#define LvCamInfo_VFactor2(x) ((x)->ScanMode==Scn_ParallelField_NI              || \
                               (x)->ScanMode==Scn_4tap_2Line_NI                 || \
                               (x)->ScanMode==Scn_4tap_2HalfLine_NI             || \
                               (x)->ScanMode==Scn_4tap_2HalfLineReverse_NI      || \
                               (x)->ScanMode==Scn_4tap_2HalfLineDiverge_NI      || \
                                0)
*/

#define LvCamInfo_VFactorScan4(x) \
                              ((x)==Scn_4tap_4Line_NI                 || \
                                0)

#define LvCamInfo_VFactor4(x) LvCamInfo_VFactorScan4((x)->ScanMode)




#define LvCamInfo_HFactor(x) (LvCamInfo_HFactor4(x) ? 4 : LvCamInfo_HFactor2(x) ? 2 : 1)
#define LvCamInfo_VFactor(x) (LvCamInfo_VFactor4(x) ? 4 : LvCamInfo_VFactor2(x) ? 2 : 1)

#define LvCamInfo_HFactorScan(x) (LvCamInfo_HFactorScan4(x) ? 4 : LvCamInfo_HFactorScan2(x) ? 2 : 1)
#define LvCamInfo_VFactorScan(x) (LvCamInfo_VFactorScan4(x) ? 4 : LvCamInfo_VFactorScan2(x) ? 2 : 1)

#define LvCamInfo_IsCLMedium(x) (\
            ((x)->Reserved[0]==Dvs_BW_10 && (x)->VideoType==VT_RGB) || \
            ((x)->Reserved[0]==Dvs_BW_12 && (x)->VideoType==VT_RGB) || \
            ((x)->ScanMode==Scn_4tap_1Line_NI             ) ||         \
            ((x)->ScanMode==Scn_4tap_1Line_I              ) ||         \
            ((x)->ScanMode==Scn_4tap_HalfLine_NI          ) ||         \
            ((x)->ScanMode==Scn_4tap_HalfLine_I           ) ||         \
            ((x)->ScanMode==Scn_4tap_HalfLineReverse_NI   ) ||         \
            ((x)->ScanMode==Scn_4tap_HalfLineReverse_I    ) ||         \
            ((x)->ScanMode==Scn_4tap_HalfLineDiverge_NI   ) ||         \
            ((x)->ScanMode==Scn_4tap_HalfLineDiverge_I    ) ||         \
            ((x)->ScanMode==Scn_4tap_2Line_NI             ) ||         \
            ((x)->ScanMode==Scn_4tap_2Line_I              ) ||         \
            ((x)->ScanMode==Scn_4tap_2HalfLine_NI         ) ||         \
            ((x)->ScanMode==Scn_4tap_2HalfLine_I          ) ||         \
            ((x)->ScanMode==Scn_4tap_2HalfLineReverse_NI  ) ||         \
            ((x)->ScanMode==Scn_4tap_2HalfLineReverse_I   ) ||         \
            ((x)->ScanMode==Scn_4tap_2HalfLineDiverge_NI  ) ||         \
            ((x)->ScanMode==Scn_4tap_2HalfLineDiverge_I   ) ||         \
            ((x)->ScanMode==Scn_4tap_4Line_NI             ) ||         \
            ((x)->ScanMode==Scn_4tap_4Line_I              ) ||         \
            ((x)->ScanMode==Scn_4tap_QuarterLine_NI       ) ||         \
            ((x)->ScanMode==Scn_4tap_QuarterLine_I        ) ||         \
            ((x)->ScanMode==Scn_4tap_QuarterLineReverse_NI) ||         \
            ((x)->ScanMode==Scn_4tap_QuarterLineReverse_I ) ||         \
            ((x)->ScanMode==Scn_4tap_QuarterLineDiverge_NI) ||         \
            0)

/** Determines the maximum camera width from a LvCameraInfo structure.
 * This is a macro to determine, out of a LvCameraInfo structure, the
 * maximum image width in pixels for the defined camera.\n
 * @note Note that, being implemented as a macro, the compiler performs no formal
 *       parameter check.
 * @param x Pointer to a LvCameraInfo structure.
 * @return The maximum width, in pixels, for the camera described by the
 *         LvCameraInfo structure passed as parameter.
 */
// #define LvCamInfo_MaxWidth(x) ((((U16BIT)((x)->Timing.Hbs*10e5*(x)->Smp+.5)-(U16BIT)((x)->Timing.Hbe*10e5*(x)->Smp+.5)))*
//                               (LvCamInfo_IsDigitalQ(x) ? 4 : (LvCamInfo_IsDigitalD(x) || (x)->ScanMode==Scn_ParallelPixel_I || (x)->ScanMode==Scn_ParallelPixel_NI) ? 2 : 1))


#define LvCamInfo_MaxWidth(x) ((((U16BIT)((x)->Timing.Hbs*10e5*(x)->Smp+.5)-(U16BIT)((x)->Timing.Hbe*10e5*(x)->Smp+.5)))*\
                              (LvCamInfo_HFactor4(x) ? 4 : LvCamInfo_HFactor2(x) ? 2 : 1))

/** Determines the maximum camera height from a LvCameraInfo structure.
 * This is a macro to determine, out of a LvCameraInfo structure, the
 * maximum image height in lines for the defined camera.\n
 * @note Note that, being implemented as a macro, the compiler performs no formal
 *       parameter check.
 * @param x Pointer to a LvCameraInfo structure.
 * @return The maximum height, in lines, for the camera described by the
 *         LvCameraInfo structure passed as parameter.
 */
// #define LvCamInfo_MaxHeight(x) ((x)->Timing.Vbs-(x)->Timing.Vbe)
#define LvCamInfo_MaxHeight(x) (((x)->Timing.Vbs-(x)->Timing.Vbe)*\
                              (LvCamInfo_VFactor4(x) ? 4 : LvCamInfo_VFactor2(x) ? 2 : 1))

/*? Determines whether the LvCameraInfo structure describes a slave camera.
 * This is a macro to determine, out of a LvCameraInfo structure, whether
 * the described camera is slave.\n
 * @note Note that, being implemented as a macro, the compiler performs no formal
 *       parameter check.
 * @param x Pointer to a LvCameraInfo structure.
 * @return \b TRUE if the camera is slave, otherwise \b FALSE.
 */
#define LvCamInfo_IsSlave(x) (((x)->Signal[CSig_CSync].Enabled && (x)->Signal[CSig_CSync].InOut==CSigIO_Input) || \
                              ((x)->Signal[CSig_HSync].Enabled && (x)->Signal[CSig_HSync].InOut==CSigIO_Input) || \
                              ((x)->Signal[CSig_VSync].Enabled && (x)->Signal[CSig_VSync].InOut==CSigIO_Input) || \
                              ((x)->Signal[CSig_PxlClock].Enabled && (x)->Signal[CSig_PxlClock].InOut==CSigIO_Input))
//@}

/** Information data for monitors
 * @sa LvCameraInfo
 */
typedef LvCameraInfo LvMonitorInfo;

#include <lvpackof.h>

#endif

⌨️ 快捷键说明

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