NXPCUP-libary
Library for car's control board on NXPCUP competition based on the Mbed framework.
Classes | Public Types | List of all members
nxpcup::BorderDetector Class Reference

#include <BorderDetector.h>

Classes

struct  Config
 

Public Types

using ImageType = Camera::ImageType
 
 BorderDetector (Config config)
 
void initalize (const std::array< ImageType, Config::dataSize > &data, const uint8_t percentCoefficient=100)
 
int findBorder (const std::array< ImageType, Config::dataSize > &data)
 
int leftDistanceFromCenter () const
 
int rightDistanceFromCenter () const
 
int error (const int percentCoefficient=100) const
 
int leftBorder () const
 
int rightBorder () const
 

Member Typedef Documentation

Constructor & Destructor Documentation

nxpcup::BorderDetector::BorderDetector ( Config  config)
inline

Constructor of class BorderDetector.

Parameters
configstructConfig}

Member Function Documentation

int nxpcup::BorderDetector::error ( const int  percentCoefficient = 100) const
inline

Calculate the error from the actual border (left and right) as distance from the center.

Parameters
percentCoefficienthow many percent of error return (0 <-> 100) default value: 100 percent
Returns
if the value is smaller than 0, the line of left side is closer to center then the line on right side if the value is bigger than 0, then the result is opposite
int nxpcup::BorderDetector::findBorder ( const std::array< ImageType, Config::dataSize > &  data)
inline

Find the maximal values from center and set position of this max value as left and right border.

Parameters
dataimage from camera
void nxpcup::BorderDetector::initalize ( const std::array< ImageType, Config::dataSize > &  data,
const uint8_t  percentCoefficient = 100 
)
inline

Initialize the detector and set threshold value. Need to have correct data from a camera with well visible lanes.

Parameters
dataimage from camera
percentCoefficienthow many percent of error return (0 <-> 100)
int nxpcup::BorderDetector::leftBorder ( ) const
inline

Get the position of left border (0 <->Config::dataSize}).

int nxpcup::BorderDetector::leftDistanceFromCenter ( ) const
inline

Get distance just with information about left border. Take data from last callfindBorder}.

int nxpcup::BorderDetector::rightBorder ( ) const
inline

Get the position of right border (0 <->Config::dataSize}).

int nxpcup::BorderDetector::rightDistanceFromCenter ( ) const
inline

Get distance just with information about right border. Take data from last callfindBorder}.


The documentation for this class was generated from the following file: