mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
fix bug in approxPolyDP: calculate distance to a segment, not to a line
This commit is contained in:
@@ -377,6 +377,19 @@ TEST(Imgproc_ApproxPoly, bad_epsilon)
|
||||
ASSERT_ANY_THROW(approxPolyDP(inputPoints, outputPoints, eps, false));
|
||||
}
|
||||
|
||||
TEST(Imgproc_ApproxPoly, distace_between_point_and_segment)
|
||||
{
|
||||
vector<Point2f> inputPoints = {
|
||||
{ {0.f, 0.f}, {4.f, 2.f}, {11.f, 1.f}, {8.f, 0.f} }
|
||||
};
|
||||
std::vector<Point2f> result;
|
||||
approxPolyDP(inputPoints, result, 1.9, false);
|
||||
vector<Point2f> expectedResult = {
|
||||
{ {0.f, 0.f}, {11.f, 1.f}, {8.f, 0.f} }
|
||||
};
|
||||
ASSERT_EQ(result, expectedResult);
|
||||
}
|
||||
|
||||
struct ApproxPolyN: public testing::Test
|
||||
{
|
||||
void SetUp()
|
||||
|
||||
Reference in New Issue
Block a user