JeVois  1.20
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
PostProcessorSegment.H
Go to the documentation of this file.
1 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 //
3 // JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2021 by Laurent Itti, the University of Southern
4 // California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5 //
6 // This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7 // redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8 // Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10 // License for more details. You should have received a copy of the GNU General Public License along with this program;
11 // if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12 //
13 // Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14 // Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16 /*! \file */
17 
18 #pragma once
19 
21 
22 namespace jevois
23 {
24  namespace dnn
25  {
26  //! Post-Processor for neural network pipeline
27  /*! This is the last step in a deep neural network processing Pipeline. \ingroup dnn */
29  public Parameter<postprocessor::segtype, postprocessor::alpha,
30  postprocessor::cthresh, postprocessor::bgid>
31  {
32  public:
33 
34  //! Inherited constructor ok
35  using PostProcessor::PostProcessor;
36 
37  //! Destructor
38  virtual ~PostProcessorSegment();
39 
40  //! Freeze/unfreeze parameters that users should not change while running
41  void freeze(bool doit) override;
42 
43  //! Process outputs and draw/send some results
44  void process(std::vector<cv::Mat> const & outs, PreProcessor * preproc) override;
45 
46  //! Report what happened in last process() to console/output video/GUI
47  void report(jevois::StdModule * mod, jevois::RawImage * outimg = nullptr,
48  jevois::OptGUIhelper * helper = nullptr, bool overlay = true, bool idle = false) override;
49 
50  protected:
51  void postInit() override; //!< Create colormap in postInit()
52  std::array<uint32_t, 256> itsColor; //!< Colors for our drawings, as RGBA with zero alpha value
53 
54  private:
55  template <typename T>
56  void process(cv::Mat const & results);
57 
58  jevois::OptGUIhelper * itsHelper = nullptr;
59  int itsTLx = 0, itsTLy = 0, itsBRx = 0, itsBRy = 0;
60  cv::Mat itsOverlay;
61  };
62 
63  } // namespace dnn
64 } // namespace jevois
jevois::dnn::PostProcessorSegment::process
void process(std::vector< cv::Mat > const &outs, PreProcessor *preproc) override
Process outputs and draw/send some results.
Definition: PostProcessorSegment.C:151
jevois::dnn::PostProcessorSegment
Post-Processor for neural network pipeline.
Definition: PostProcessorSegment.H:28
jevois::dnn::PostProcessorSegment::~PostProcessorSegment
virtual ~PostProcessorSegment()
Destructor.
Definition: PostProcessorSegment.C:29
jevois::RawImage
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
Definition: RawImage.H:110
jevois::GUIhelper
Helper class to assist modules in creating graphical and GUI elements.
Definition: GUIhelper.H:128
jevois
Definition: Concepts.dox:1
jevois::dnn::PreProcessor
Pre-Processor for neural network pipeline.
Definition: PreProcessor.H:108
jevois::dnn::PostProcessorSegment::freeze
void freeze(bool doit) override
Freeze/unfreeze parameters that users should not change while running.
Definition: PostProcessorSegment.C:37
PostProcessor.H
jevois::dnn::PostProcessorSegment::postInit
void postInit() override
Create colormap in postInit()
Definition: PostProcessorSegment.C:43
jevois::dnn::PostProcessor
Post-Processor for neural network pipeline.
Definition: PostProcessor.H:146
jevois::dnn::PostProcessorSegment::itsColor
std::array< uint32_t, 256 > itsColor
Colors for our drawings, as RGBA with zero alpha value.
Definition: PostProcessorSegment.H:52
jevois::dnn::PostProcessorSegment::report
void report(jevois::StdModule *mod, jevois::RawImage *outimg=nullptr, jevois::OptGUIhelper *helper=nullptr, bool overlay=true, bool idle=false) override
Report what happened in last process() to console/output video/GUI.
Definition: PostProcessorSegment.C:176
jevois::StdModule
Base class for a module that supports standardized serial messages.
Definition: Module.H:232