JeVoisBase  1.20
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
SuperPixel.H
Go to the documentation of this file.
1 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 //
3 // JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2016 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 #include <jevois/Types/Enum.H>
22 
23 #include <opencv2/core/core.hpp>
24 #include <opencv2/imgproc/imgproc.hpp>
25 
26 namespace superpixel
27 {
28  static jevois::ParameterCategory const ParamCateg("SuperPixel Options");
29 
30  //! Enum for parameter \relates SuperPixel
31  JEVOIS_DEFINE_ENUM_CLASS(Algo, (SLIC) (SLICO) (SEEDS) ); // could later also support LSC
32 
33  //! Parameter \relates SuperPixel
34  JEVOIS_DECLARE_PARAMETER(algo, Algo, "Algorithm variant to use", Algo::SLICO, Algo_Values, ParamCateg);
35 
36  //! Parameter \relates SuperPixel
37  JEVOIS_DECLARE_PARAMETER(regionsize, int, "SLIC Region size", 30, ParamCateg);
38 
39  //! Parameter \relates SuperPixel
40  JEVOIS_DECLARE_PARAMETER(numpix, int, "Number of SEEDS superpixels", 200, ParamCateg);
41 
42  //! Parameter \relates SuperPixel
43  JEVOIS_DECLARE_PARAMETER(iterations, int, "Number of iterations", 6, jevois::Range<int>(1, 100), ParamCateg);
44 
45  //! Enum for parameter \relates SuperPixel
46  JEVOIS_DEFINE_ENUM_CLASS(OutType, (Labels) (Contours) );
47 
48  //! Parameter \relates SuperPixel
49  JEVOIS_DECLARE_PARAMETER(output, OutType, "Output labels or demo grayscale input image with superimposed contours",
50  OutType::Contours, OutType_Values, ParamCateg);
51 } // namespace superpixel
52 
53 //! Superpixel image segmentation from OpenCV
54 /*! See tutorial at http://docs.opencv.org/3.2.0/df/d6c/group__ximgproc__superpixel.html
55  and http://docs.opencv.org/3.0-beta/modules/ximgproc/doc/superpixels.html \ingroup components */
57  public jevois::Parameter<superpixel::algo, superpixel::regionsize, superpixel::numpix,
58  superpixel::iterations, superpixel::output>
59 {
60  public:
61  //! Default Component constructor ok
63 
64  //! Virtual destructor for safe inheritance
65  virtual ~SuperPixel() { }
66 
67  //! Process an RGB image and get some greyscale results
68  /*! outimg should be allocated with same size as the input and CV_8UC1 pixels. */
69  void process(cv::Mat const & inimg, cv::Mat & outimg);
70 };
71 
72 
73 
jevois::ParameterRegistry::Component
friend friend class Component
jevois::Range
JEVOIS_DECLARE_PARAMETER
JEVOIS_DECLARE_PARAMETER(thresh1, double, "First threshold for hysteresis", 50.0, ParamCateg)
jevois::Component
jevois::ParameterCategory
SuperPixel::~SuperPixel
virtual ~SuperPixel()
Virtual destructor for safe inheritance.
Definition: SuperPixel.H:65
Component.H
superpixel
Definition: SuperPixel.H:26
Enum.H
SuperPixel::process
void process(cv::Mat const &inimg, cv::Mat &outimg)
Process an RGB image and get some greyscale results.
Definition: SuperPixel.C:23
SuperPixel
Superpixel image segmentation from OpenCV.
Definition: SuperPixel.H:56
JEVOIS_DEFINE_ENUM_CLASS
JEVOIS_DEFINE_ENUM_CLASS(CameraSensor,(any)(imx290)(os08a10)(ar0234))