Drovisio
Functions
detector_color.h File Reference
#include "opencv2/core.hpp"
#include <opencv2/core/utility.hpp>
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include "detector_common.h"
#include <cctype>
#include <stdio.h>
#include <string>
#include <sstream>
#include <math.h>
#include <iostream>
#include <fstream>
Include dependency graph for detector_color.h:

Go to the source code of this file.

Functions

void det_col::convert_image (InputArray image, OutputArray hsv)
 Converts an RGB image to an HSV image, ready to be used by det_col::scan_image. More...
 
void det_col::scan_image (det_com::Config &config, InputArray image, InputOutputArray debug_image, vector< det_com::Block > &blocks)
 Scans an image and extracts the detected blocks using color markers. More...
 
void det_col::equalize (InputArray input, OutputArray output)
 Equalize the Value channel of an image using CLAHE. More...
 
void det_col::threshold (InputArray input, OutputArray output, Scalar lower, Scalar upper)
 Thresholds the image. More...
 
void det_col::morphological (InputArray input, OutputArray output)
 Applies a morphological opening and closing to the black-and-white. More...
 
void det_col::detect_blobs (det_com::Config &config, InputArray input, vector< KeyPoint > &keypoints)
 Extracts blobs of pixels out of a black-and-white image. More...
 
void det_col::threshold_and_detect_blobs (det_com::Config &config, InputArray hsv, vector< Scalar > &colors, vector< Mat > &thresholded_images, vector< vector< KeyPoint > > &keypoints_per_color)
 Thresholds and extracts blobs out of an HSV image. More...
 
void det_col::find_lines (det_com::Config &config, unsigned long count_points, vector< vector< KeyPoint > > &keypoints_per_color, InputOutputArray debug_image, vector< det_com::Line > &lines)
 Finds lines of n color markers. More...
 
void det_col::match_lines (det_com::Config &config, unsigned long count_points, vector< vector< KeyPoint > > &keypoints_per_color, vector< det_com::Line > lines, InputOutputArray result_image, vector< det_com::Block > &blocks)
 Tries to match pair of lines (of n points) of parallel equidistant lines, producing blocks. More...
 

Function Documentation

void det_col::convert_image ( InputArray  image,
OutputArray  hsv 
)

Converts an RGB image to an HSV image, ready to be used by det_col::scan_image.

Parameters
imageImage to be converted
hsvImage converted
void det_col::detect_blobs ( det_com::Config config,
InputArray  input,
vector< KeyPoint > &  keypoints 
)

Extracts blobs of pixels out of a black-and-white image.

Warning
input should be a black-and-awhite image, such as the one outputed by mask::threshold or mask::morphological
Parameters
configConfig to be used
inputImage from where to extract blobs
[out]keypointsEmpty that will contain the detected blobs
void det_col::equalize ( InputArray  input,
OutputArray  output 
)

Equalize the Value channel of an image using CLAHE.

Parameters
inputImage to equalize
[out]outputEqualized image
void det_col::find_lines ( det_com::Config config,
unsigned long  count_points,
vector< vector< KeyPoint > > &  keypoints_per_color,
InputOutputArray  debug_image,
vector< det_com::Line > &  lines 
)

Finds lines of n color markers.

Parameters
configConfig to be used
count_pointsn
keypoints_per_colorVector of size n containing, for each color, a vector of detected keypoints of this color
void det_col::match_lines ( det_com::Config config,
unsigned long  count_points,
vector< vector< KeyPoint > > &  keypoints_per_color,
vector< det_com::Line lines,
InputOutputArray  result_image,
vector< det_com::Block > &  blocks 
)

Tries to match pair of lines (of n points) of parallel equidistant lines, producing blocks.

Parameters
configConfig to be used
count_pointsn
keypoints_per_colorVector of size n containing, for each color, a vector of detected keypoints of this color
linesVector containing the lines
void det_col::morphological ( InputArray  input,
OutputArray  output 
)

Applies a morphological opening and closing to the black-and-white.

Warning
input should be a black-and-white image, such as the one outputed by mask::threshold
Parameters
inputBlack-and-white to process
[out]outputBlack-and-white image after the processing
void det_col::scan_image ( det_com::Config config,
InputArray  image,
InputOutputArray  debug_image,
vector< det_com::Block > &  blocks 
)

Scans an image and extracts the detected blocks using color markers.

Warning
image should be properly converted with convert_image
Parameters
configConfig struct containing the configuration
imageImage to be scanned
void det_col::threshold ( InputArray  input,
OutputArray  output,
Scalar  lower,
Scalar  upper 
)

Thresholds the image.

Note
Hue wraps around 180. Thus, if the hue in lower is higher than the hue in upper, the threshold interval will catch any hue in [lower, 180] and [0, upper]
Parameters
inputImage to be thresholded
[out]outputBlack-and-White image where white pixels are the ones in the interval
lower3-component vector corresponding to the minimum hue, saturation and value values
upper3-component vector corresponding to the maximum hue, saturation and value values
void det_col::threshold_and_detect_blobs ( det_com::Config config,
InputArray  hsv,
vector< Scalar > &  colors,
vector< Mat > &  thresholded_images,
vector< vector< KeyPoint > > &  keypoints_per_color 
)

Thresholds and extracts blobs out of an HSV image.

Parameters
configConfig to be used
hsvImage to threshold and from which to extract blobs
colorsVector of size 2*n containing the interval for the different colors
[out]thresholded_imagesEmpty vector that will contain the thresholded images, for debugging purposed
[out]keypoints_per_colorEmpty vector that will contain, for each color, the list of detected color marks