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