-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathcamera.h
52 lines (43 loc) · 1.08 KB
/
camera.h
1
2
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
44
45
46
47
48
49
50
51
52
#pragma once
#include <opencv2/opencv.hpp>
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>
#include <QObject>
#include <QScopedPointer>
#include <QTimerEvent>
#include <stdio.h>
#include <iostream>
#include <QImage>
#include <QBasicTimer>
#include <QDebug>
class Camera : public QObject
{
Q_OBJECT
QScopedPointer<cv::VideoCapture> videoCapture_;
QBasicTimer timer_;
bool run_;
bool usingVideoCamera_;
int cameraIndex_;
cv::String videoFileName_;
public:
Camera(int camera_index=0, QObject* parent=0) : QObject(parent)
{
cameraIndex_ = camera_index;
usingVideoCamera_ = true;
}
~Camera();
QImage convertToQImage( cv::Mat frame );
public slots:
void runSlot();
void cameraIndexSlot(int index);
void videoFileNameSlot(QString fileName);
void usingVideoCameraSlot(bool value);
void stopped();
signals:
void started();
void matReady(const cv::Mat &);
private:
void timerEvent(QTimerEvent * ev);
};