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