JeVoisBase
1.20
JeVois Smart Embedded Machine Vision Toolkit Base Modules
|
Share this page: |
|
|
|
|
|
|
Go to the documentation of this file.
54 #include <opencv2/core/core.hpp>
55 #define INVT_TYPEDEF_INT64
56 #define INVT_TYPEDEF_UINT64
58 #include <opencv2/video/tracking.hpp>
149 "with 0 at the top of the frame). Adjust this depending on the tilt angle of your camera "
150 "and video input resolution.",
154 JEVOIS_DECLARE_PARAMETER(support,
int,
"Offset (in pixels) between horizon line and horizon support line (positive "
155 "values means support line is below horizon line.",
177 public jevois::Parameter<roadfinder::horizon, roadfinder::support,
178 roadfinder::spacing, roadfinder::distthresh>
238 std::vector<Point2D<int> >
242 std::vector<Point2D<int> >
244 std::vector<uint>& startIndexes);
247 std::vector<Point2D<int> >
251 Line findLine2(
Segment const & s, cv::Mat
const & edgeMap, std::list<Segment>
const & supportingSegments,
252 std::vector<bool> & is_used,
float & totalLength,
uint & numSegments);
256 int const width,
int const height);
268 int const width,
int const height);
275 std::vector<Line>
combine(std::vector<Line> & prevLines, std::vector<Line>
const & currentLines,
276 int width,
int height);
RoadFinder(std::string const &instance)
constructor
Line findLine2(Segment const &s, cv::Mat const &edgeMap, std::list< Segment > const &supportingSegments, std::vector< bool > &is_used, float &totalLength, uint &numSegments)
find lines given the found supporting segments
std::mutex itsAccTrajMtx
locking accunulated trajectory
bool isActive
tracks whether the line can be used for finding the road center
Point2D< float > itsAccumulatedTrajectory
the accumulated trajectory
float itsVanishingPointConfidence
current vanishing point
Point2D< float > computeRoadCenterPoint(cv::Mat const &edgeMap, std::vector< Line > &lines, Point2D< int > &vanishing_point, Point2D< float > &road_center_point, float &confidence)
computes the road center point to servo to
Point2D< float > pointToServo
JEVOIS_DECLARE_PARAMETER(thresh1, double, "First threshold for hysteresis", 50.0, ParamCateg)
std::vector< Line > computeVanishingLines(cv::Mat const &edgeMap, Point2D< int > const &vanishingPoint, jevois::RawImage &visual)
main function to detect the road
VanishingPoint(Point2D< int > in_vp, float in_likelihood)
std::vector< Point2D< int > > getPixels(Point2D< int > const &p1, Point2D< int > const &p2, cv::Mat const &edgeMap)
get pixels for segment defined by p1 and p2 have added complexity to search within 1....
cv::KalmanFilter itsTPXfilter
std::vector< bool > itsVanishingPointStability
vanishing point score tracker
Point2D< float > horizonSupportPoint
Point2D< float > onScreenRoadBottomPoint
void updateRoadModel(std::vector< Line > &lines, int index)
update road model and incoming lines NOTE: also change the line parameters to sync them this avoids d...
std::vector< int > lastActiveIndex
std::mutex itsTrackMtx
locking line trackers vars
void fitLine(std::vector< Point2D< int > > const &points, Point2D< float > &p1, Point2D< float > &p2, int const width, int const height)
openCV wrapper function to fit a line to an input vector of points
Store information about the road.
float getFilteredTargetX() const
Get the kalman-fitered target X, can be used to set robot steering.
bool itsTrackingFlag
indicate whether tracking
void computeHoughSegments(cv::Mat const &cvImage)
compute the hough segments in the image
std::vector< float > scores
tracking information to monitor health of the line
Point2D< float > horizonPoint
quick information for various locations with respect to the road
keeps all the ready to use information of a supporting line as it pertains to describing the road
std::vector< Line > itsCurrentLines
the current lines being tracked
Point2D< int > itsVanishingPoint
current vanishing point
Point2D< float > onScreenHorizonPoint
std::pair< Point2D< int >, float > getCurrVanishingPoint() const
Get the current vanishing point and confidence.
Point2D< float > getCurrTargetPoint() const
Get the current target point.
float length
basic information to specify the line
Keeps all the supporting information about a specific vanishing point.
int itsCurrentMessageID
for visualizer
bool operator<(const Segment &s)
void projectForwardVanishingLines(std::vector< Line > &lines, std::vector< cv::Mat > const &edgeMaps, jevois::RawImage &visual)
update the lines with the inputted set of edgemaps
Point2D< float > itsTargetPoint
target servo point
std::vector< float > start_scores
std::vector< VanishingPoint > itsVanishingPoints
vanishing points being considered
Point2D< float > getCurrCenterPoint() const
Get the current road center point.
void process(cv::Mat const &img, jevois::RawImage &visual)
Compute the vanishing point location using the full blown algorithm.
void trackVanishingLines(cv::Mat const &edgeMap, std::vector< Line > ¤tLines, jevois::RawImage &visual)
track vanishing lines by to fit to the new, inputted, edgemap
std::vector< Point2D< int > > points
the points that are fit to the line
std::vector< Line > combine(std::vector< Line > &prevLines, std::vector< Line > const ¤tLines, int width, int height)
combine two lines sets, discard duplicates and overlaps
std::vector< Point2D< float > > lastSeenHorizonPoint
cv::Mat cvImage(RawImage const &src)
a segment is defined by the two end-points
virtual ~RoadFinder()
desctructor
void resetRoadModel()
Reset all tracker internals and start fresh (e.g., when changing goal direction)
Point2D< float > roadBottomPoint
std::vector< Segment > itsCurrentSegments
current segments found using CVHoughlines
unsigned int uint
Canonical unsigned int.
std::vector< Line > lines
uint itsNumIdentifiedLines
indicate how many unique lines have been identified NOTE: never reset
double itsRoadHeading
the current road heading
std::vector< Segment > supportingSegments
void updateLine(Line &l, std::vector< Point2D< int > > const &points, float score, int const width, int const height)
update the information in by updating the input points, score and various handy coordinate locations
void postInit() override
This class has state and does not support some online param changes.
Point2D< int > getVanishingPoint(std::vector< Line > const &lines, float &confidence)
estimate the vanishing point from the tracked lines
float getLineFitness(Point2D< int > const &horizonPoint, Point2D< int > const &roadBottomPoint, cv::Mat const &edgeMap, jevois::RawImage &visual)
compute how well the line equation fit the edgels in edgemap
std::vector< Point2D< int > > getPixelsQuick(Point2D< int > const &p1, Point2D< int > const &p2, cv::Mat const &edgeMap)
get pixels that make up the segment defined by p1 and p2
Segment(Point2D< int > in_p1, Point2D< int > in_p2, float in_angle, float in_length)
std::vector< Line > discardDuplicates(std::vector< Line > const ¤tLines)
discard duplicate lines in a set
Point2D< float > onScreenHorizonSupportPoint
std::vector< Segment > segments
original supporting segments out of sync after initial frame
std::vector< int > numMatches
std::vector< Point2D< float > > lastSeenLocation
void preUninit() override
This class has state and does not support some online param changes.
Point2D< float > itsCenterPoint
current center of road point
Navigation by finding road.