Subversion Repositories seema-scanner

Rev

Rev 4 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef CAMERA_H
#define CAMERA_H

//header files included in the two camera APIs for XIMEA and IDS (possibly recursively)
//#ifdef __unix__                    /* __unix__ is usually defined by compilers targeting Unix systems */
//    #include <unistd.h>
//    #include <stdint.h>
//    //#include "wintypedefs.h"
//#elif defined(_WIN32) || defined(WIN32)     /* _Win32 is usually defined by compilers targeting 32 or   64 bit Windows systems */
//    #include <windows.h>
//    //#include <WinNT.h>
//#endif

#include <iostream>
#include <vector>

struct CameraFrame {
    unsigned char *memory;
    unsigned int width;
    unsigned int height;
    unsigned int sizeBytes;
    unsigned int timeStamp;
    CameraFrame(): memory(NULL), width(0), height(0), sizeBytes(0), timeStamp(0){}
};

struct CameraSettings {
    float gain;
    float shutter; // [ms]
    CameraSettings(): gain(0.0), shutter(0.0) {}
};

struct CameraInfo {
    std::string vendor;
    std::string model;
    unsigned int busID;
};

// Abstract base class for camera implementations
class Camera {
    public:
        // Static "camera factory" methods
        static std::vector< std::vector<CameraInfo> > GetInterfaceCameraList();
        static Camera* NewCamera(unsigned int interfaceNum, unsigned int camNum);
        // Interface function
        Camera() : capturing(false){}
        virtual CameraSettings getCameraSettings() = 0;
        virtual void setCameraSettings(CameraSettings) = 0;
        virtual void startCapture() = 0;
        virtual void stopCapture() = 0;
        virtual CameraFrame lockFrame() = 0;
        virtual void unlockFrame() = 0;
        virtual CameraFrame getSingleFrame() = 0;
        virtual size_t getFrameSizeBytes() = 0;
        virtual void getFrameWidthHeight(unsigned int *width, unsigned int *height) = 0;
        bool isCapturing(){return capturing;}
        virtual ~Camera(){}
    protected:
        bool capturing;
};

#endif