35#include <drain/image/EdgeTracker.h>
36#include <drain/PseudoTuple.h>
42#include "SegmentProber.h"
112 control.markVisited(pos);
137 return this->conf.anchor.contains(src.
get<src_t>(pos.i, pos.j));
142 bool checkNext(
Position & pos, Direction::value_t dir, TreeSVG & tree){
153 mout <<
"check" << pos <<
' ' << Direction::arrows.getValue(dir) <<
" <" << dir<<
">";
156 switch (control.move(pos, dir)){
157 case ProberControl::MOVE_ACCEPTED:
160 mout <<
" mark" << pos;
162 control.markVisited(pos);
171 if (dir != Direction::NONE){
173 mout <<
" NEW SEG! " << mout.endl;
175 edgeTracker.track(pos, dir);
176 if (edgeTracker.contour.size() > 0){
179 c.setType(
typeid(std::string));
181 for (
const Position & p: edgeTracker.contour){
182 c << p.i <<
',' << p.j <<
' ';
193 dst->
put(pos.i, pos.j, 192);
197 dst->
put(pos.i, pos.j, 85);
205 case ProberControl::COORD_ERROR:
206 mout <<
" COORD_ERROR ";
209 case ProberControl::DIR_ERROR:
210 mout <<
" DIR_ERROR ";
250 while (checkNext(pos, dir, tree)){
253 if (dir == Direction::NONE){
254 dir = Direction::RIGHT;
262 if (checkNext(p, DIR_TURN_DEG(dir, 90), tree)){
264 std::cout <<
"090" <<
" = " << p.i <<
',' << p.j <<
'\n';
266 probe2(p, DIR_TURN_DEG(dir, 180), tree);
270 if (checkNext(p, DIR_TURN_DEG(dir, 270), tree)){
272 std::cout <<
"270" <<
" = " << p.i <<
',' << p.j <<
'\n';
274 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:312
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:60
Container for parameters of SegmentProber.
Definition EdgeTracker.h:73
void put(size_t i, T x)
Sets the intensity in location i to x. See \address.
Definition ImageFrame.h:192
T get(size_t i) const
Gets the intensity at location i. See address().
Definition ImageFrame.h:254
A recursive method for visiting pixels of a segment in an image.
Definition SegmentProber.h:100
A DIRECTED recursive method for visiting pixels of a segment in an image.
Definition SuperProber.h:81
void probe2(Position pos, Direction::value_t dir, TreeSVG &tree)
Definition SuperProber.h:243
virtual bool isValidSegment(int i, int j) const
Application dependent, to be redefined. Assumes checked coordinates.
Definition SuperProber.h:124
virtual void update(const Position &pos)
Application dependent operation performed in each segment location (i,j).
Definition SuperProber.h:105
virtual void clear()
Called before processing each segment. Compare with init(), which is called once for each image.
Definition SuperProber.h:99
virtual bool isNewSegment(const Position &pos, Direction::value_t dir) const
Application dependent. Assumes checked coordinates.
Definition SuperProber.h:136
Definition DataSelector.cpp:1277
Definition Direction.h:46
Container for parameters of SegmentProber.
Definition SuperProber.h:61