35#include <drain/image/EdgeTracker.h>
39#include "SegmentProber.h"
109 control.markVisited(pos);
134 return this->conf.anchor.contains(src.
get<src_t>(pos.i, pos.j));
139 bool checkNext(
Position & pos, Direction::value_t dir, TreeSVG & tree){
150 mout <<
"check" << pos <<
' ' << Direction::arrows.getValue(dir) <<
" <" << dir<<
">";
153 switch (control.move(pos, dir)){
154 case ProberControl::MOVE_ACCEPTED:
157 mout <<
" mark" << pos;
159 control.markVisited(pos);
168 if (dir != Direction::NONE){
170 mout <<
" NEW SEG! " << mout.endl;
172 edgeTracker.track(pos, dir);
173 if (edgeTracker.contour.size() > 0){
176 c.setType(
typeid(std::string));
178 for (
const Position & p: edgeTracker.contour){
179 c << p.i <<
',' << p.j <<
' ';
190 dst->
put(pos.i, pos.j, 192);
194 dst->
put(pos.i, pos.j, 85);
202 case ProberControl::COORD_ERROR:
203 mout <<
" COORD_ERROR ";
206 case ProberControl::DIR_ERROR:
207 mout <<
" DIR_ERROR ";
247 while (checkNext(pos, dir, tree)){
250 if (dir == Direction::NONE){
251 dir = Direction::RIGHT;
259 if (checkNext(p, DIR_TURN_DEG(dir, 90), tree)){
261 std::cout <<
"090" <<
" = " << p.i <<
',' << p.j <<
'\n';
263 probe2(p, DIR_TURN_DEG(dir, 180), tree);
267 if (checkNext(p, DIR_TURN_DEG(dir, 270), tree)){
269 std::cout <<
"270" <<
" = " << p.i <<
',' << p.j <<
'\n';
271 probe2(p, DIR_TURN_DEG(dir, 180), tree);
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition Log.h:313
Definition StringBuilder.h:58
VariableT is a final class applied through typedefs Variable, Reference and FlexibleVariable.
Definition VariableT.h:87
Image with static geometry.
Definition ImageChannel.h:58
Container for parameters of SegmentProber.
Definition EdgeTracker.h:72
void put(size_t i, T x)
Sets the intensity in location i to x. See \address.
Definition ImageFrame.h:187
T get(size_t i) const
Gets the intensity at location i. See address().
Definition ImageFrame.h:249
A recursive method for visiting pixels of a segment in an image.
Definition SegmentProber.h:98
A DIRECTED recursive method for visiting pixels of a segment in an image.
Definition SuperProber.h:78
void probe2(Position pos, Direction::value_t dir, TreeSVG &tree)
Definition SuperProber.h:240
virtual bool isValidSegment(int i, int j) const
Application dependent, to be redefined. Assumes checked coordinates.
Definition SuperProber.h:121
virtual void update(const Position &pos)
Application dependent operation performed in each segment location (i,j).
Definition SuperProber.h:102
virtual void clear()
Called before processing each segment. Compare with init(), which is called once for each image.
Definition SuperProber.h:96
virtual bool isNewSegment(const Position &pos, Direction::value_t dir) const
Application dependent. Assumes checked coordinates.
Definition SuperProber.h:133
Definition DataSelector.cpp:1277
Definition Direction.h:46
Container for parameters of SegmentProber.
Definition SuperProber.h:58