source: pacpussensors/trunk/Vislab/VislabViewerComponent.cpp

Last change on this file was 148, checked in by ldecherf, 7 years ago

Ajout VislabViewerComponent

File size: 1.7 KB
Line 
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
19using 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
25ComponentFactory<VislabViewerComponent> sFactory("VislabViewerComponent");
26
27VislabViewerComponent::VislabViewerComponent(QString const& name)
28 :ComponentBase(name)
29{
30
31}
32
33VislabViewerComponent::~VislabViewerComponent()
34{
35
36
37}
38
39void
40VislabViewerComponent::stopActivity()
41{
42
43}
44
45void
46VislabViewerComponent::startActivity()
47{
48 qRegisterMetaType<cv::Mat>("cv::Mat");
49 connect(this, SIGNAL(doDisplay(cv::Mat)), SLOT(DisplayFrame(cv::Mat)));
50}
51
52ComponentBase::COMPONENT_CONFIGURATION
53VislabViewerComponent::configureComponent(XmlComponentConfig config)
54{
55 return ComponentBase::CONFIGURED_OK;
56}
57
58void VislabViewerComponent::addInputs()
59{
60 addInput<cv::Mat, VislabViewerComponent>("image", &VislabViewerComponent::process);
61 addInput<cv::Mat, VislabViewerComponent>("disparity", &VislabViewerComponent::process);
62}
63
64void 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
70Emit the signal to diplay the frame
71*/
72void VislabViewerComponent::process(cv::Mat const& frame)
73{
74 emit doDisplay(frame);
75}
76
77QString VislabViewerComponent::getName()
78{
79 return mName;
80}
81
82
83
Note: See TracBrowser for help on using the repository browser.