source: pacpussensors/trunk/CameraViewer/CameraViewerComponent.cpp@ 141

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

Ajout du composant CameraViewer (input pour le composant Vislab)

File size: 1.6 KB
Line 
1
2// Includes, project.
3#include "CameraViewerComponent.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 <QMetaType>
15#include <iostream>
16
17
18using namespace pacpus;
19
20// Declare the logger and register the new component.
21//DECLARE_STATIC_LOGGER("pacpus.component.vislabCamera")
22//REGISTER_COMPONENT(CameraViewerComponent, "Camera");
23
24ComponentFactory<CameraViewerComponent> sFactory("CameraViewerComponent");
25
26CameraViewerComponent::CameraViewerComponent(QString const& name)
27 :ComponentBase(name)
28{
29
30}
31
32CameraViewerComponent::~CameraViewerComponent()
33{
34
35
36}
37
38void
39CameraViewerComponent::stopActivity()
40{
41
42}
43
44void
45CameraViewerComponent::startActivity()
46{
47 qRegisterMetaType<cv::Mat>("cv::Mat");
48 connect(this, SIGNAL(doDisplay(cv::Mat)), SLOT(DisplayFrame(cv::Mat)));
49}
50
51ComponentBase::COMPONENT_CONFIGURATION
52CameraViewerComponent::configureComponent(XmlComponentConfig config)
53{
54 return ComponentBase::CONFIGURED_OK;
55}
56
57void CameraViewerComponent::addInputs()
58{
59 addInput<cv::Mat, CameraViewerComponent>("image", &CameraViewerComponent::process);
60}
61
62void CameraViewerComponent::DisplayFrame(cv::Mat const& frame)
63{
64 //getchar();
65 //std::cout << getName().toStdString() << std::endl;
66 cv::imshow(getName().toStdString(), frame);
67 //cv::imshow("Image", frame);
68}
69
70/*! process function from the Display class with a cv:Mat parameter
71Emit the signal to diplay the frame
72*/
73void CameraViewerComponent::process(cv::Mat const& frame)
74{
75 emit doDisplay(frame);
76}
77
78
79
Note: See TracBrowser for help on using the repository browser.