return 0;
}
-void LabelledImage::crop(int xmin, int ymin, int width, int height) {
- RichImage::crop(xmin, ymin, width, height);
- for(int t = 0; t < _nb_targets; t++) {
- _target_poses[t].translate(- xmin, - ymin);
- }
-}
-
-void LabelledImage::reduce() {
- int xmin = _width, xmax = 0, ymin = _height, ymax = 0;
- if(_nb_targets > 0) {
- for(int t = 0; t < _nb_targets; t++) {
- xmin = min(xmin, int(_target_poses[t]._bounding_box_xmin));
- ymin = min(ymin, int(_target_poses[t]._bounding_box_ymin));
- xmax = max(xmax, int(_target_poses[t]._bounding_box_xmax));
- ymax = max(ymax, int(_target_poses[t]._bounding_box_ymax));
- }
- } else {
- xmin = 0; ymin = 0;
- xmax = 640; ymax = 480;
- }
- xmin = max(0, xmin);
- ymin = max(0, ymin);
- xmax = min(_width, xmax);
- ymax = min(_height, ymax);
- crop(xmin, ymin, xmax - xmin, ymax - ymin);
-}
-
void LabelledImage::write(ostream *out) {
int v = file_format_version;
write_var(out, &v);