ImageAcquisition.h 1.44 KB
Newer Older
Thiago Santini's avatar
Thiago Santini committed
1 2
#ifndef IMAGEACQUISITION_H
#define IMAGEACQUISITION_H
Thiago C. Santini's avatar
Thiago C. Santini committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

#include <QObject>
#include <QMessageBox>
#include <QElapsedTimer>
#include <QtConcurrent/QtConcurrentRun>

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

#include "VideoManControl.h"
#include "VideoManInputFormat.h"

#include "Journal.h"

#include "PerfCounter.h"

#include "settings.h"

using namespace std;
using namespace cv;
using namespace VideoMan;

typedef struct {
    string name;
    VMInputFormat format;
    int id;
    Mat sample;
    IplImage buffer;
} Camera;

class ImageAcquisition : public QObject
{
    Q_OBJECT
public:
    explicit ImageAcquisition(QObject *parent = 0);
    ~ImageAcquisition();

    void setUndistortionMaps( Size size );
    static void frameCallback(char *pixelBuffer, size_t input, double timestamp, void *data);
    void frameCallbackInternal(char *pixelBuffer, size_t input, double timestamp);
    QString camToStr(Camera cam);
44
    void naiveDeinterlace(Mat &in);
Thiago C. Santini's avatar
Thiago C. Santini committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58

    bool ready;

    VideoManControl videoManControl;
    vector<Camera> cameras;
    double recordingStarted;
    Camera *master;
    Mat map1;
    Mat map2;
    QFuture<void> slaveThread;
    QMutex slaveMutex;
    Mat latestSlaveFrame;
    Camera *slave;
    bool running;
59
    int dropCountWhenStarting;
Thiago C. Santini's avatar
Thiago C. Santini committed
60 61 62 63 64 65

signals:
    void imageAcquisitionDone(JournalEntry journalEntry);

public slots:
    void onThreadStarted();
Thiago C. Santini's avatar
Thiago C. Santini committed
66
    void onThreadFinishing();
Thiago C. Santini's avatar
Thiago C. Santini committed
67 68 69 70


};

Thiago Santini's avatar
Thiago Santini committed
71
#endif // IMAGEACQUISITION_H