3 #ifndef __TRAVIS_LIB_HPP__
4 #define __TRAVIS_LIB_HPP__
8 #include "opencv2/core/mat.hpp"
9 #include "opencv2/core/types.hpp"
51 bool binarize(
const char* algorithm);
58 bool binarize(
const char* algorithm,
const double& threshold);
66 bool binarize(
const char* algorithm,
const double& min,
const double& max);
85 int blobize(
const int& maxNumBlobs);
91 void pushContour(
const std::vector<cv::Point>& contour);
97 bool getBlobsXY(std::vector<cv::Point2d> &locations);
111 bool getBlobsRect(std::vector<cv::Rect>& rects);
118 bool getBlobsAngle(
const int& method, std::vector<double>& angles);
126 bool getBlobsAspectRatio(std::vector<double>& aspectRatios, std::vector<double>& axisFirsts, std::vector<double>& axisSeconds);
128 bool getBlobsPerimeter(std::vector<double>& perimeters);
145 bool getBlobsHSV(std::vector<double>& hues, std::vector<double>& vals, std::vector<double>& sats,
146 std::vector<double>& hueStdDevs, std::vector<double>& valStdDevs, std::vector<double>& satStdDevs);
154 cv::Mat&
getCvMat(
const int& image,
const int& vizualization);
192 bool compareContourAreas (std::vector<cv::Point> contour1, std::vector<cv::Point> contour2 );
199 bool travisCrop(
const int x,
const int y,
const int width,
const int height, cv::Mat& img);
211 void calcLocationXY(
float& locX,
float& locY,
const std::vector<cv::Point> biggestCont);
217 void calcMask(cv::Mat& mask,
const std::vector<cv::Point> biggestCont);
223 void calcArea(
float& area,
const std::vector<cv::Point> biggestCont);
229 void calcRectangularity(
float& rectangularity,
const std::vector<cv::Point> biggestCont);
235 void calcAngle(
float& angle,
const std::vector<cv::Point> biggestCont);
241 void calcMassCenter(
float& massCenterLocX,
float& massCenterLocY ,
const std::vector<cv::Point> biggestCont);
247 void calcAspectRatio(
float& aspectRatio,
float& axisFirst,
float& axisSecond ,
const std::vector<cv::Point> biggestCont);
253 void calcSolidity(
float& solidity,
const std::vector<cv::Point> biggestCont);
259 void calcHSVMeanStdDev(
const cv::Mat image,
const cv::Mat mask,
float& hue_mean,
float& hue_stddev,
260 float& saturation_mean,
float& saturation_stddev,
261 float& value_mean,
float& value_stddev);
267 void calcHSVPeakColor(
const cv::Mat image,
const cv::Mat mask,
float& hue_mode,
float& hue_peak,
268 float& value_mode,
float& value_peak);
274 void calcMoments(cv::Mat& theHuMoments,
const std::vector<cv::Point> biggestCont );
280 void calcArcLength(
float& arc,
const std::vector<cv::Point> biggestCont );
286 void calcCircle(
float& radius,
const std::vector<cv::Point> biggestCont );
The Travis class implements all the algorithms on a single image.
Definition: TravisLib.hpp:24
void release()
Definition: TravisLib.cpp:539
cv::Mat _imgBin3
Definition: TravisLib.hpp:178
bool setCvMat(const cv::Mat &image)
Definition: TravisLib.cpp:20
cv::Mat _img
Definition: TravisLib.hpp:169
bool getBlobsAspectRatio(std::vector< double > &aspectRatios, std::vector< double > &axisFirsts, std::vector< double > &axisSeconds)
Definition: TravisLib.cpp:410
void morphClosing(const int &closure)
Definition: TravisLib.cpp:210
bool _overwrite
Definition: TravisLib.hpp:166
bool binarize(const char *algorithm)
Definition: TravisLib.cpp:74
std::vector< std::vector< cv::Point > > _contours
Definition: TravisLib.hpp:181
void pushContour(const std::vector< cv::Point > &contour)
Definition: TravisLib.cpp:258
void morphOpening(const int &opening)
Definition: TravisLib.cpp:221
bool getBlobsRectangularity(std::vector< double > &rectangularities)
Definition: TravisLib.cpp:429
bool setBinCvMat(const cv::Mat &image)
Definition: TravisLib.cpp:43
cv::Mat _imgHsv
Definition: TravisLib.hpp:172
cv::Mat & getCvMat(const int &image, const int &vizualization)
Definition: TravisLib.cpp:498
cv::Mat _imgBin
Definition: TravisLib.hpp:175
int blobize(const int &maxNumBlobs)
Definition: TravisLib.cpp:232
Travis(bool quiet=true, bool overwrite=true)
Definition: TravisLib.hpp:31
bool _quiet
Definition: TravisLib.hpp:163
std::vector< cv::RotatedRect > _minRotatedRects
Definition: TravisLib.hpp:184
bool getBlobsHSV(std::vector< double > &hues, std::vector< double > &vals, std::vector< double > &sats, std::vector< double > &hueStdDevs, std::vector< double > &valStdDevs, std::vector< double > &satStdDevs)
Definition: TravisLib.cpp:451
bool getBlobsArea(std::vector< double > &areas)
Definition: TravisLib.cpp:303
bool getBlobsSolidity(std::vector< double > &solidities)
Definition: TravisLib.cpp:331
bool getBlobsAngle(const int &method, std::vector< double > &angles)
Definition: TravisLib.cpp:363
bool getBlobsXY(std::vector< cv::Point2d > &locations)
Definition: TravisLib.cpp:268
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:5
void calcSolidity(float &solidity, const std::vector< cv::Point > biggestCont)
Definition: TravisLib.cpp:706
std::vector< cv::Point > getBiggestContour(const cv::Mat image)
Definition: TravisLib.cpp:574
void calcArcLength(float &arc, const std::vector< cv::Point > biggestCont)
Definition: TravisLib.cpp:858
void calcAspectRatio(float &aspectRatio, float &axisFirst, float &axisSecond, const std::vector< cv::Point > biggestCont)
Definition: TravisLib.cpp:685
void calcMassCenter(float &massCenterLocX, float &massCenterLocY, const std::vector< cv::Point > biggestCont)
Definition: TravisLib.cpp:670
void calcArea(float &area, const std::vector< cv::Point > biggestCont)
Definition: TravisLib.cpp:633
bool travisCrop(const int x, const int y, const int width, const int height, cv::Mat &img)
Definition: TravisLib.cpp:561
void calcHSVPeakColor(const cv::Mat image, const cv::Mat mask, float &hue_mode, float &hue_peak, float &value_mode, float &value_peak)
Definition: TravisLib.cpp:750
void calcHSVMeanStdDev(const cv::Mat image, const cv::Mat mask, float &hue_mean, float &hue_stddev, float &saturation_mean, float &saturation_stddev, float &value_mean, float &value_stddev)
Definition: TravisLib.cpp:720
bool compareContourAreas(std::vector< cv::Point > contour1, std::vector< cv::Point > contour2)
Definition: TravisLib.cpp:552
void calcRectangularity(float &rectangularity, const std::vector< cv::Point > biggestCont)
Definition: TravisLib.cpp:639
void calcAngle(float &angle, const std::vector< cv::Point > biggestCont)
Definition: TravisLib.cpp:656
void calcMoments(cv::Mat &theHuMoments, const std::vector< cv::Point > biggestCont)
Definition: TravisLib.cpp:851
void calcCircle(float &radius, const std::vector< cv::Point > biggestCont)
Definition: TravisLib.cpp:864
void calcMask(cv::Mat &mask, const std::vector< cv::Point > biggestCont)
Definition: TravisLib.cpp:620
void calcLocationXY(float &locX, float &locY, const std::vector< cv::Point > biggestCont)
Definition: TravisLib.cpp:608