skillfed

quadrilateral-fitter

QuadrilateralFitter is an efficient and easy-to-use Python library for fitting irregular quadrilaterals from irregular polygons or any noisy data.

quadrilateral-fitter v1.12 117.3K downloads/30d#12,167 on PyPI31
Permissive license MIT DORMANT released

What it is and what it does

QuadrilateralFitter solves the problem of extracting a clean four-corner polygon from noisy or irregular shape detections. It takes a polygon defined by any number of points and finds the smallest-area quadrilateral that fully contains all those points, minimizing the Intersection Over Union (IoU) metric. The library wraps shapely, numpy, and scipy to perform the geometric optimization.

Typical use is cleaning up detections from computer vision pipelines—such as form boundaries or document corners detected with noise—before applying perspective correction or template matching. You instantiate it with a polygon (as a numpy array, list, tuple, or shapely Polygon), call fit() to get the corners, or access tight_quadrilateral for a tighter fit when some point loss is acceptable. The package includes optional Douglas-Peucker simplification to speed up processing on large convex hulls.

Use it for:

  • Clean up noisy document or form corner detections from image processing before perspective correction.
  • Extract a four-corner bounding quadrilateral from irregular polygon detections in computer vision pipelines.
  • Prepare shape data for template matching by fitting a quadrilateral to noisy point cloud input.
  • Simplify irregular polygons to corners for downstream geometric analysis or pattern recognition.
  • Reduce noise in polygon data from sensor or detection systems before further processing steps.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Fits the smallest-area quadrilateral that contains all points from a noisy polygon or point cloud, useful for cleaning up irregular detections before perspective correction or pattern matching.

Yes, if you need to fit quadrilaterals to noisy polygons or point clouds. The package is lightweight, has no known vulnerabilities, and carries a permissive MIT license. Maintenance is dormant but the code is stable and the dependency set is standard. Install it if your workflow involves cleaning up shape detections; skip it if you need active support or ongoing feature development.

Install

quadrilateral-fitter on PyPI

pip

pip install quadrilateral-fitter

uv

uv add quadrilateral-fitter

poetry

poetry add quadrilateral-fitter

Installing quadrilateral-fitter

Before you install

Low friction: pure Python wheel with three common dependencies (shapely, numpy, scipy). Maintenance is dormant—last commit was 2024-08-25—but the package is marked Production/Stable and carries no known vulnerabilities.

License in practice

MIT license is permissive: you can use, modify, and distribute this package freely in commercial or private projects with minimal restrictions, provided you include the license notice.

Quickstart

pip install quadrilateral-fitter

from quadrilateral_fitter import QuadrilateralFitter
import numpy as np

noisy_polygon = np.array([[x1, y1], [x2, y2], ...])  # Your polygon points
fitter = QuadrilateralFitter(polygon=noisy_polygon)
fitted_quad = fitter.fit()  # Returns tuple of (x, y) corners

Verify before relying

  • Whether the package works correctly with very large point clouds or whether performance degrades significantly.
  • How the Douglas-Peucker simplification threshold (default 10) affects accuracy in typical real-world use cases.
  • Whether the tight_quadrilateral property is suitable as a drop-in replacement when some point loss is acceptable.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 3 — shapely, numpy, scipy
Maintenance dormant — 716 days since the last release
Last repo commit
First released
Downloads 117,330/month — #12,167 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: quadrilateral_fitter-1.12-py3-none-any.whl

Keywords: quadrilateral, fitter, polygon, shape analysis, geometry

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: Image RecognitionTopic :: Scientific/Engineering :: Information AnalysisTopic :: Scientific/Engineering :: MathematicsTopic :: Scientific/Engineering :: VisualizationTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities

Tags

fit quadrilateral to polygonnoisy shape detection cleanupperspective correction preparationfour-corner polygon fittingpoint cloud to quadrilateralgeometry shape approximationpolygon simplification to quad
geometrycomputer-visionshape-fitting

More Libraries packages