source: pacpussensors/trunk/CameraViewer/CameraViewerComponent.cpp

Last change on this file was 147, checked in by ldecherf, 8 years ago

Ajout CameraPlayer

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