EtherCAT Control Framework v0.9
Implementation of EtherCAT protocol using IgH EtherCAT library for robot controller.
video_capture.hpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * $Id$
4 *
5 * Copyright (C) 2021 Veysi ADIN, UST KIST
6 *
7 * This file is part of the IgH EtherCAT master userspace program in the ROS2 environment.
8 *
9 * The IgH EtherCAT master userspace program in the ROS2 environment is free software; you can
10 * redistribute it and/or modify it under the terms of the GNU General
11 * Public License as published by the Free Software Foundation; version 2
12 * of the License.
13 *
14 * The IgH EtherCAT master userspace program in the ROS2 environment is distributed in the hope that
15 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with the IgH EtherCAT master userspace program in the ROS environment. If not, see
21 * <http://www.gnu.org/licenses/>.
22 *
23 * ---
24 *
25 * The license mentioned above concerns the source code only. Using the
26 * EtherCAT technology and brand is only permitted in compliance with the
27 * industrial property and similar rights of Beckhoff Automation GmbH.
28 *
29 * Contact information: veysi.adin@kist.re.kr
30 *****************************************************************************/
31/*****************************************************************************
32 * \file video_capture.hpp
33 * \brief Class header for video capture from endoscope camera by using OpenCV to show in GUI
34 *******************************************************************************/
35#ifndef VIDEO_CAPTURE_HPP
36#define VIDEO_CAPTURE_HPP
37
38// QT headers for image and reading thread.
39#include <QPixmap>
40#include <QImage>
41#include <QThread>
42// OpenCV headers for camera capture.
43#include <opencv2/opencv.hpp>
44#include "opencv2/highgui/highgui.hpp"
45#include <opencv2/imgproc.hpp>
46#include <opencv2/core/core.hpp>
47
58#include "gui_globals.hpp"
59
60class VideoCapture : public QThread
61{
62 Q_OBJECT
63public:
64 VideoCapture(QObject *parent = nullptr);
65 QPixmap pixmap() const { return pixmap_cap;}
66signals:
67 //capture a frame
69protected:
70 void run() override;
71private:
72
73 QPixmap pixmap_cap; //Qt image
74 cv::Mat frame_cap; //OpenCV image
75 cv::VideoCapture video_cap; //video capture
76
77 unsigned long frame_rate = 30;
78 uint8_t cam_id = ID_CAMERA ;
79 // Convert opencv readings to QImage && QPixmap format
80 QImage cvMatToQImage(const cv::Mat &inMat);
81 QPixmap cvMatToQPixmap(const cv::Mat &inMat );
82};
83
84#endif // MYVIDEOCAPTURE_H
Definition: video_capture.hpp:61
uint8_t cam_id
Definition: video_capture.hpp:78
QPixmap pixmap_cap
Definition: video_capture.hpp:73
QPixmap cvMatToQPixmap(const cv::Mat &inMat)
Definition: video_capture.cpp:102
QPixmap pixmap() const
Definition: video_capture.hpp:65
void run() override
Definition: video_capture.cpp:11
QImage cvMatToQImage(const cv::Mat &inMat)
Definition: video_capture.cpp:35
unsigned long frame_rate
Definition: video_capture.hpp:77
VideoCapture(QObject *parent=nullptr)
Definition: video_capture.cpp:4
cv::Mat frame_cap
Definition: video_capture.hpp:74
cv::VideoCapture video_cap
Definition: video_capture.hpp:75
void NewPixmapCapture()
#define ID_CAMERA
Definition: gui_globals.hpp:3