1 |
|
---|
2 |
|
---|
3 | // Includes, project.
|
---|
4 | #include "VislabComponent.hpp"
|
---|
5 | #include "VislabCamera.hpp"
|
---|
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 | #include <lib3dv/device.h>
|
---|
13 | //#include <20150310_lib3dv-1.2.0/src/display.h>
|
---|
14 |
|
---|
15 | // Includes, qt.
|
---|
16 | #include <QDir>
|
---|
17 | #include <QMetaType>
|
---|
18 |
|
---|
19 | // Includes, standard.
|
---|
20 | #include <stdexcept>
|
---|
21 |
|
---|
22 | #include <boost/asio/io_service.hpp>
|
---|
23 | #include <boost/bind.hpp>
|
---|
24 | #include <boost/ref.hpp>
|
---|
25 | #include <boost/thread.hpp>
|
---|
26 |
|
---|
27 | using namespace pacpus;
|
---|
28 |
|
---|
29 | // Declare the logger and register the new component.
|
---|
30 | //DECLARE_STATIC_LOGGER("pacpus.component.vislabCamera")
|
---|
31 | //REGISTER_COMPONENT(VislabComponent, "Camera");
|
---|
32 |
|
---|
33 | ComponentFactory<VislabComponent> sFactory("VislabComponent");
|
---|
34 |
|
---|
35 | VislabComponent::VislabComponent(QString const& name)
|
---|
36 | :ComponentBase(name),
|
---|
37 | camera(name)
|
---|
38 | {
|
---|
39 |
|
---|
40 | }
|
---|
41 |
|
---|
42 | VislabComponent::~VislabComponent()
|
---|
43 | {
|
---|
44 |
|
---|
45 |
|
---|
46 | }
|
---|
47 |
|
---|
48 | void
|
---|
49 | VislabComponent::stopActivity()
|
---|
50 | {
|
---|
51 | camera.close();
|
---|
52 | }
|
---|
53 |
|
---|
54 | void
|
---|
55 | VislabComponent::startActivity()
|
---|
56 | {
|
---|
57 | camera.open();
|
---|
58 |
|
---|
59 | try
|
---|
60 | {
|
---|
61 | camera.setVideoOutput(getTypedOutput<cv::Mat, VislabComponent>("image"));
|
---|
62 | camera.setDispariteOutput(getTypedOutput<cv::Mat, VislabComponent>("disparity"));
|
---|
63 | }
|
---|
64 | catch (std::exception const& e)
|
---|
65 | {
|
---|
66 | LOG_ERROR(e.what());
|
---|
67 | }
|
---|
68 |
|
---|
69 |
|
---|
70 | }
|
---|
71 |
|
---|
72 | ComponentBase::COMPONENT_CONFIGURATION
|
---|
73 | VislabComponent::configureComponent(XmlComponentConfig config)
|
---|
74 | {
|
---|
75 | return ComponentBase::CONFIGURED_OK;
|
---|
76 | }
|
---|
77 |
|
---|
78 | void VislabComponent::addOutputs()
|
---|
79 | {
|
---|
80 | addOutput<cv::Mat, VislabComponent>("image");
|
---|
81 | addOutput<cv::Mat, VislabComponent>("disparity");
|
---|
82 | }
|
---|
83 |
|
---|
84 |
|
---|
85 |
|
---|