24 #include <fvmodels/scanlines/line_grid.h> 26 #include <fvutils/base/roi.h> 27 #include <fvutils/draw/drawer.h> 28 #include <core/exceptions/software.h> 61 unsigned int offset_hor,
unsigned int offset_ver,
62 ROI* roi,
unsigned int gap)
65 __next_pixel = gap + 1;
67 offset_hor, offset_ver, roi);
91 ScanlineLineGrid::calc_coords()
94 bool more_to_come =
true;
101 next_px = std::min(__next_pixel, __offset_ver ? __offset_ver : __width);
103 coord.
y = __roi->
start.
y + ((__roi->
height - 1) % __offset_hor) / 2;
104 __point_list.push_back(coord);
106 while (more_to_come) {
116 coord.
y += __offset_hor;
120 more_to_come =
false;
124 if (more_to_come) __point_list.push_back(coord);
128 if (__offset_ver > 0)
131 next_px = std::min(__next_pixel, __offset_hor ? __offset_hor : __height);
132 coord.
x = __roi->
start.
x + ((__roi->
width - 1) % __offset_ver) / 2;
134 __point_list.push_back(coord);
136 while (more_to_come) {
145 coord.
x += __offset_ver;
150 more_to_come =
false;
154 if (more_to_come) __point_list.push_back(coord);
164 if (__cur != __point_list.end()) ++__cur;
165 return __cur != __point_list.end() ? &*__cur : &__point_list.back();
171 if (__cur != __point_list.end()) {
175 else return &__point_list.back();
181 return __cur == __point_list.end();
187 __cur = __point_list.begin();
193 return "ScanlineModel::LineGrid";
200 return std::max(__offset_ver, __offset_hor);
246 if (!roi) __roi =
new ROI(0, 0, __width, __height, __width, __height);
273 __offset_hor = offset_hor;
274 __offset_ver = offset_ver;
295 unsigned int offset_hor,
unsigned int offset_ver,
298 __offset_hor = offset_hor;
299 __offset_ver = offset_ver;
virtual ~ScanlineLineGrid()
Destructor.
fawkes::upoint_t start
ROI start.
unsigned int y
y coordinate
unsigned int x
x coordinate
unsigned int width
ROI width.
virtual void set_offset(unsigned int offset_x, unsigned int offset_y)
Sets offset.
fawkes::upoint_t operator*()
Get the current coordinate.
void set_image_height(unsigned int image_height)
Set full image height Set the height of the image that contains this ROI.
unsigned int image_width
width of image that contains this ROI
virtual void set_dimensions(unsigned int width, unsigned int height, ROI *roi=NULL)
Sets the dimensions of the grid.
bool finished()
Check if all desired points have been processed.
unsigned int image_height
height of image that contains this ROI
void set_image_width(unsigned int image_width)
Set full image width.
virtual void set_robot_pose(float x, float y, float ori)
Set the robot's pose.
const char * get_name()
Get name of scanline model.
Point with cartesian coordinates as unsigned integers.
unsigned int get_margin()
Get margin around points.
virtual void set_roi(ROI *roi=NULL)
Sets the region-of-interest.
unsigned int height
ROI height.
fawkes::upoint_t * operator++()
Postfix ++ operator.
virtual void set_pan_tilt(float pan, float tilt)
Set camera's pan/tilt values.
fawkes::upoint_t * operator->()
Get pointer to current point.
ScanlineLineGrid(unsigned int width, unsigned int height, unsigned int offset_hor, unsigned int offset_ver, ROI *roi=NULL, unsigned int gap=0)
Constructor.
virtual void set_grid_params(unsigned int width, unsigned int height, unsigned int offset_hor, unsigned int offset_ver, ROI *roi=NULL)
Set all grid parameters.