segmentation
All Data Structures Namespaces Files Functions Variables Modules Pages
dispBlobber.hpp
1 /*
2  * Copyright (C) 2015 iCub Facility - Istituto Italiano di Tecnologia
3  * Authors: Tanis Mar, Giulia Pasquale
4  * email: tanis.mar@iit.it, giulia.pasquale@iit.it
5  * Permission is granted to copy, distribute, and/or modify this program
6  * under the terms of the GNU General Public License, version 2 or any
7  * later version published by the Free Software Foundation.
8  *
9  * A copy of the license can be found at
10  * http://www.robotcub.org/icub/license/gpl.txt
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15  * Public License for more details
16  */
17 
18 #ifndef __DISPBLOBBER_H__
19 #define __DISPBLOBBER_H__
20 
21 #include <string>
22 #include <vector>
23 #include <numeric>
24 
25 #include <opencv2/opencv.hpp>
26 
27 class dispBlobber
28 {
29  int margin;
30 
31  int backgroundThresh;
32 
33  int minBlobSize;
34  int maxBlobSize;
35  int gaussSize;
36 
37  int imageThreshRatioLow;
38  int imageThreshRatioHigh;
39 
40  cv::Scalar blue, green, red, white;
41 
42  cv::Mat aux, fillMask;
43 
44  std::vector<cv::Point2f > center2DcoordsBuffer;
45  int bufferSize;
46 
47  cv::Point mean_centroid;
48 
49 public:
50 
51  dispBlobber(int imH, int imW, int _bufferSize,
52  int _margin,
53  int _backgroundThresh,
54  int _minBlobSize, int _maxBlobSize, int _gaussSize,
55  int _dispThreshRatioLow, int _dispThreshRatioHigh);
56 
57  bool setThresh(int low);
58  bool setMargin(int mrg);
59 
60  double extractBlob(std::vector<cv::Mat> &images, std::vector<int> &roi, std::vector<int> &centroid, cv::Mat &blob);
61 
62 };
63 
64 #endif