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

📄 grabber.h

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

//=====================================================================
//[HEADER/OEM] Grabber
// LvGrabberNode definition
//+
//[AUTHOR]
// Bruno Rivara
//.


#ifndef ___GRABBER_H
#define ___GRABBER_H

#include <dsydef.h>
#include <camera.h>
#include <lvmonitr.h>
#include <cnnctr2.h>
#include <roi.h>
#include <nodes.h>
#include <scaler.h>
#include <tgtbuff.h>
#include <lvintq.h>

#include <lvpackon.h>

#define _GrbProc_RecalculateHwParam 0xe0000001


LVDSYCLASS LvAIMNode;
// LVDSYCLASS LvAOMNode;
LVDSYCLASS LvFrameBufferNode;
class RPSHandler;
/*
typedef struct _tagLvCameraAccess {
    HCAMERA hCamera;
    LvCameraNode *TheCamera;
    LvPort *TheAccessPort[Tgt_Last];
    } LvCameraAccess;

typedef struct _tagLvMonitorAccess {
    HMONITOR hMonitor;
    LvMonitorNode *TheMonitor;
    LvPort *TheAccessPort;
    } LvMonitorAccess;
*/
// Forward declarations
struct _tagLvCameraAccess;
struct _tagLvMonitorAccess;
struct _tagLvIntNotify;
struct _tagLvIntMap;

typedef struct _tagLvGrabberIOConnector {
    U32BIT Count;
    LvConnectionInfo *ConnInfo;
    } LvGrabberIOConnector;

/** Class LvGrabberNode represents a video grabber installed in the system.
 * Objects belonging to the LvGrabberNode class represent a graphic
 * board installed in the system.\n
 * More than one grabber can be installed in the system, Daisy will provide
 * different LvGrabberNode objects and each of them will act only on the
 * physical board it represents.\n
 * \n
 * \b Handles \b and \b connections \n
 * External equipment, like monitors and cameras, can be connected to a
 * grabber; in its base concept a grabber supports more than one input and
 * more than one output connections; so, in order to ask Daisy to operate on
 * the correct equipment an application has to use Handles.\n
 * All the handles representing external equipment are of type
 * HCONNECTION; for easier code readability are also defined the HCAMERA
 * and HMONITOR typedefs.\n
 * Through a handle, the application can still have a reference to the object it
 * represents, so it can directly use its interface.\n
 * \n
 * \b Monitors \n
 * More than one monitor could be connected to the hardware, of course if
 * the hardware itself can support them. The actual implementation of the
 * hardware can support only one monitor connection, so these methods are
 * kept for future use; to maintain future compatibility also the user
 * application are recommended to use the query methods instead of
 * assuming a one-monitor system.\n
 * Actually Daisy takes care of connecting the monitor and of activating it
 * during its initialization, so the application has not to deal with this system
 * setting.\n
 * \n
 * \b Input \b Connectors \n
 * In order to allow the end user to choose the input where the camera will be
 * connected to, Daisy offers query methods to retrieve data about the
 * connectors still free in the system. These information can be then
 * presented to the end user that will choose the desired input; the connector
 * descriptor maintains also a ASCII string that will match the description on
 * the physical cable (i.e. RGB1, YC_C1 and so on).\n
 * \n
 * \b Cameras \n
 * The LvGrabberNode allows the user application to connect a Camera to
 * the grabber, activate or deactivate it.\n
 * Each camera is represented in Daisy by a Handle that uniquely identifies it
 * in the system; the user can use this handle to refer to a specific input
 * equipment when accessing other grabber methods.\n
 * Knowing its handle, a user application can retrieve a pointer to each
 * LvCameraNode object.
  * @sa LvCameraNode
 */
LVDSYCLASS LvGrabberNode : public LvNode {

    private:


    protected:
        enum _NodeId {
            FrameBuffer_Id=300,
            AOM_Id,
            AIM_Id
            };


        virtual LVSTATUS _OutStartAddress(U32BIT *StartAddress);
        virtual LVSTATUS _OutPixelDepth(U8BIT *PxDepth);
        virtual LVSTATUS _OutScreenWidth(U32BIT *Width, U8BIT PixelDepth);
        virtual LVSTATUS _OutScreenHeight(U32BIT *Height);
        virtual LVSTATUS _OutColorFormat(U8BIT *NrColorComponent, U8BIT *BitPerColor, U8BIT *ColorPerComponent);
        virtual void    AdjustOutROISize(LvROI *Info, LvCameraNode *TheCamera) {}

        LvFrameBufferNode *FB;
        LvAOMNode *AOM;
        LvAIMNode *AIM;
        LvDevDescr DevDesc;
        U16BIT FirstTarget;
        U8BIT  NrTarget;
        U32BIT Flags;

        int NrCamera;
        // LvCameraAccess *TheCameraAccess;
        struct _tagLvCameraAccess *TheCameraAccess;
        int NrMonitor;
        // LvMonitorAccess *TheMonitorAccess;
        struct _tagLvMonitorAccess *TheMonitorAccess;

        LvConnector *TheConnector;
        LvConnector *TheIOConnector;
        HCAMERA  AddCamera(LvCameraNode *Camera);
        int      GetCameraIndex(HCAMERA hCamera);
        LVHMONITOR AddMonitor(LvMonitorNode *Monitor);
        U8BIT ConnId;

        LvGrabberIOConnector *IOConn;

        virtual LvAIMNode *GetAIMFromId(U8BIT ModuleNr) { return AIM; }
        virtual LvConnector *CreateConnector(void) { return NULL; }
        virtual LvConnector *CreateIOConnector(void) { return NULL; }
        virtual LvFrameBufferNode *CreateFrameBufferNode(U16BIT Id);
        virtual LvAOMNode *CreateAOMNode(U16BIT Id);

        virtual void FillOutputInfo(void);
        virtual LVSTATUS AccessConfigChanged(LvPort *FromPort);

        virtual LVSTATUS ConnectSubNode(LvNode *Node);
        virtual LVSTATUS CreateStaticSubNodes(void);
        virtual LVSTATUS MsgConnect(LvPort *FromPort, U8BIT Direction);
        virtual LVSTATUS Setup(void);
        virtual LvScalerNode *GetScaler(HCONNECTION hConnection) { return NULL; }
                U8BIT  GetTargetIndex(U16BIT NodeId);
                U8BIT  GetGrabberIndex(void);
                LvPort *GetCameraOutPort(LvExtDeviceNode *Cam) { return Cam ? Cam->OutPort : NULL; }


                LvGrabberNode(LvDevDescr *aDevice, U16BIT anId=0, LPSTR ExtName=NULL, LvNode *aParentNode=NULL);
        virtual ~LvGrabberNode(void);

        friend LVDSYAPI(void) DsyClose(void);
        #ifdef _LVDSY_
        friend void LvDsyBuildBoardList(void);
        #ifndef __WIN3264__
        friend int FAR PASCAL LibMain(HINSTANCE, WORD, WORD, LPSTR);
        #else
		#ifdef _MSC_VER
		friend BOOL WINAPI DllMain(HINSTANCE,DWORD,LPVOID);
		#else
        friend BOOL WINAPI DllEntryPoint (HINSTANCE, DWORD, LPVOID);
        #endif
        #endif
        #endif

        // Interrupts handling
        struct _tagLvIntNotify *IntNotify;
        U32BIT *IntCount;
        struct _tagLvIntMap *IntMap;
        int    IntTaskId;
        virtual void _InitInt(void) {}
        virtual void _HwAdjust(void) {}
        virtual void _InitComm(void) {}
        virtual BOOL _IsIntValid(U32BIT Int) { return FALSE; }
        HANDLE hIntThread;
        int IntThreadPriority;

        HANDLE hIntEvent;
        CRITICAL_SECTION IntCs;

        U32BIT CountOptocoupler(U32BIT);

        virtual LVSTATUS ActivateIO(HCONNECTOR) { return I_NoError; }
        virtual LVSTATUS DeactivateIO(HCONNECTOR) { return I_NoError; }

    public:
        #ifdef __UNIX__
        // static int SigNr;
        /** Returns number of signal which is used by Daisy.
         * On unix systems there could be blocked signals goes to application.
         * Daisy needs one of the signal to keep unblocked - and this function
         * returns the number of this signal.
         * @return number of signal which is used by Daisy and which has to be unblocked
         */
        virtual int GetBoardTypeSigNr(void) { return 0; }
        #endif

        virtual void SetLastImageSeqNr(U32BIT SubGrb, U32BIT ImgNr) { }
        virtual U32BIT GetType(void) { return ND_Grabber; }

        /** Returns the name of the grabber.
         * Returns the name of the grabber as a pointer. Application should not
         * modify or write to it.
         *
         * @return A pointer to a string containing the Daisy name of the grabber
         */

⌨️ 快捷键说明

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