| 351 | } |
| 352 | |
| 353 | void ShapeMinMax( // get min and max ccords in the given shape |
| 354 | double& xmin, // out |
| 355 | double& xmax, // out |
| 356 | double& ymin, // out |
| 357 | double& ymax, // out |
| 358 | const Shape& shape) // in |
| 359 | { |
| 360 | xmin = FLT_MAX, xmax = -FLT_MAX, ymin = FLT_MAX, ymax = -FLT_MAX; |
| 361 | for (int i = 0; i < shape.rows; i++) |
| 362 | { |
| 363 | double x = shape(i, IX), y = shape(i, IY); |
| 364 | if (PointUsed(x, y)) |
| 365 | { |
| 366 | if (x < xmin) xmin = x; |
| 367 | if (x > xmax) xmax = x; |
| 368 | if (y < ymin) ymin = y; |
| 369 | if (y > ymax) ymax = y; |
| 370 | } |
| 371 | } |
| 372 | CV_Assert(xmin < FLT_MAX); |
| 373 | CV_Assert(xmin < xmax); // need at least two discrete points in shape |
| 374 | } |
| 375 | |
| 376 | double ShapeWidth(const Shape& shape) // width of shape in pixels |
| 377 | { |
no test coverage detected