24 #include <core/exceptions/software.h> 25 #include <fvmodels/scanlines/line_grid.h> 26 #include <fvutils/base/roi.h> 27 #include <fvutils/draw/drawer.h> 33 namespace firevision {
58 unsigned int offset_hor,
59 unsigned int offset_ver,
64 next_pixel_ = gap + 1;
87 ScanlineLineGrid::calc_coords()
90 bool more_to_come =
true;
97 next_px = std::min(next_pixel_, offset_ver_ ? offset_ver_ : width_);
100 + ((roi_->
height - 1) % offset_hor_) / 2;
101 point_list_.push_back(coord);
103 while (more_to_come) {
109 coord.
y += offset_hor_;
111 more_to_come =
false;
116 point_list_.push_back(coord);
123 next_px = std::min(next_pixel_, offset_hor_ ? offset_hor_ : height_);
125 + ((roi_->
width - 1) % offset_ver_) / 2;
127 point_list_.push_back(coord);
129 while (more_to_come) {
134 coord.
x += offset_ver_;
137 more_to_come =
false;
142 point_list_.push_back(coord);
152 if (cur_ != point_list_.end())
154 return cur_ != point_list_.end() ? &*cur_ : &point_list_.back();
160 if (cur_ != point_list_.end()) {
164 return &point_list_.back();
170 return cur_ == point_list_.end();
176 cur_ = point_list_.begin();
182 return "ScanlineModel::LineGrid";
188 return std::max(offset_ver_, offset_hor_);
232 roi_ =
new ROI(0, 0, width_, height_, width_, height_);
264 offset_hor_ = offset_hor;
265 offset_ver_ = offset_ver;
286 unsigned int offset_hor,
287 unsigned int offset_ver,
290 offset_hor_ = offset_hor;
291 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.