1 |
|
---|
2 |
|
---|
3 | // Includes, project.
|
---|
4 | #include "CameraViewerComponent.hpp"
|
---|
5 |
|
---|
6 |
|
---|
7 | // Includes, pacpus.
|
---|
8 | #include <Pacpus/kernel/ComponentFactory.h>
|
---|
9 | #include <Pacpus/kernel/Log.h>
|
---|
10 | #include <Pacpus/kernel/DbiteFileTypes.h>
|
---|
11 | #include <Pacpus/kernel/DbiteException.h>
|
---|
12 |
|
---|
13 | // Includes, standard.
|
---|
14 | #include <stdexcept>
|
---|
15 | #include <QMetaType>
|
---|
16 | #include <iostream>
|
---|
17 |
|
---|
18 |
|
---|
19 | using namespace pacpus;
|
---|
20 |
|
---|
21 |
|
---|
22 | ComponentFactory<CameraViewerComponent> sFactory("CameraViewerComponent");
|
---|
23 |
|
---|
24 | CameraViewerComponent::CameraViewerComponent(QString const& name)
|
---|
25 | :ComponentBase(name)
|
---|
26 | {
|
---|
27 |
|
---|
28 | }
|
---|
29 |
|
---|
30 | CameraViewerComponent::~CameraViewerComponent()
|
---|
31 | {
|
---|
32 |
|
---|
33 |
|
---|
34 | }
|
---|
35 |
|
---|
36 | void
|
---|
37 | CameraViewerComponent::stopActivity()
|
---|
38 | {
|
---|
39 |
|
---|
40 | }
|
---|
41 |
|
---|
42 | void
|
---|
43 | CameraViewerComponent::startActivity()
|
---|
44 | {
|
---|
45 | qRegisterMetaType<cv::Mat>("cv::Mat");
|
---|
46 | connect(this, SIGNAL(doDisplay(cv::Mat)), SLOT(DisplayFrame(cv::Mat)));
|
---|
47 | }
|
---|
48 |
|
---|
49 | ComponentBase::COMPONENT_CONFIGURATION
|
---|
50 | CameraViewerComponent::configureComponent(XmlComponentConfig config)
|
---|
51 | {
|
---|
52 | return ComponentBase::CONFIGURED_OK;
|
---|
53 | }
|
---|
54 |
|
---|
55 | void CameraViewerComponent::addInputs()
|
---|
56 | {
|
---|
57 | addInput<cv::Mat, CameraViewerComponent>("image", &CameraViewerComponent::process);
|
---|
58 | }
|
---|
59 |
|
---|
60 | void CameraViewerComponent::DisplayFrame(cv::Mat const& frame)
|
---|
61 | {
|
---|
62 | cv::imshow(getName().toStdString(), frame);
|
---|
63 | }
|
---|
64 |
|
---|
65 | /*! process function from the Display class with a cv:Mat parameter
|
---|
66 | Emit the signal to diplay the frame
|
---|
67 | */
|
---|
68 | void CameraViewerComponent::process(cv::Mat const& frame)
|
---|
69 | {
|
---|
70 | emit doDisplay(frame);
|
---|
71 | }
|
---|
72 |
|
---|
73 |
|
---|
74 |
|
---|