fixed bug in pad detection (area calculation was wrong)
This commit is contained in:
parent
698749a8bc
commit
2cd3df2d69
1 changed files with 7 additions and 1 deletions
|
@ -63,7 +63,13 @@ Result * PadDetect::applyInternal(Image *img)
|
|||
case PadDetect::AREA: {
|
||||
Pad pad = minAreaRect(contour);
|
||||
|
||||
double areaContour = contourArea(contour);
|
||||
Mat mask = Mat::zeros(m.size(), m.type());
|
||||
std::vector<std::vector<Point>> ctrs = { contour };
|
||||
|
||||
fillPoly(mask, ctrs, Scalar(1, 1, 1));
|
||||
mask = mask.mul(m);
|
||||
|
||||
double areaContour = countNonZero(mask);
|
||||
double areaRect = pad.getArea();
|
||||
|
||||
if (areaContour / areaRect > areaRatio)
|
||||
|
|
Loading…
Add table
Reference in a new issue