← 返回
效率工具 中文

Pywayne Cv Geometric Hull Calculator

Geometric hull calculator for 2D point sets supporting convex hull, concave hull (concave-hull, alphashape), and minimum bounding rectangle. Use when working...
用于二维点集的几何包计算器,支持凸包、凹包(concave‑hull、α‑shape)和最小外接矩形。使用时...
wangyendt
效率工具 clawhub v0.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 768
下载
💾 15
安装
1
版本
#latest

概述

Pywayne Geometric Hull Calculator

This module computes geometric hulls (convex and concave) for 2D point sets.

Quick Start

from pywayne.cv.geometric_hull_calculator import GeometricHullCalculator
import numpy as np

# Create calculator with random points
points = GeometricHullCalculator.generate_random_points(num_points=50)
calculator = GeometricHullCalculator(points, algorithm='concave-hull')

# Get results
print(f"MBR: {calculator.get_mbr()}")
print(f"Convex Hull: {calculator.get_convex_hull()}")
print(f"Concave Hull: {calculator.get_concave_hull()}")

# Visualize with matplotlib
calculator.visualize_matplotlib()

Initialization

# algorithm options: 'concave-hull' or 'alphashape'
# use_filtered_pts: Enable point filtering based on radius
calculator = GeometricHullCalculator(
    points=your_points,
    algorithm='alphashape',
    use_filtered_pts=True
)

Supported Algorithms

AlgorithmDescription
------------------------
concave-hullConcave hull using concave_hull library
alphashapeConcave hull using alphashape library

Hull Types

TypeMethodDescription
----------------------------
Convex Hullget_convex_hull()Outer hull containing all points
Concave Hullget_concave_hull()Inner concave boundary

Properties

PropertyDescription
----------------------
pointsInput 2D points (N×2 numpy array)
algorithmAlgorithm used for concave hull
use_filtered_ptsWhether filtered points were used
boxMinimum Bounding Rectangle corners
centerCenter point of input points
filter_radiusRadius used for point filtering
concave_hull_resultConcave hull points or polygons

Visualization

OpenCV Visualization

calculator.visualize_opencv()

Displays: All input points, MBR, center, filter circle (if enabled), concave hull (green), convex hull (red).

Matplotlib Visualization

calculator.visualize_matplotlib()

Displays: All input points (red), MBR (blue), center, filter radius circle (if enabled), concave hull (orange), convex hull (purple).

Requirements

  • numpy - Array operations
  • cv2 (OpenCV) - For OpenCV visualization and MBR computation
  • matplotlib - For matplotlib visualization
  • scipy - For convex hull computation
  • concave_hull - Concave hull algorithm
  • alphashape - Alphashape algorithm
  • shapely - Polygon operations for area calculation

Notes

  • Point filtering uses radius = 30% of shorter MBR edge length
  • MBR computed using OpenCV's minAreaRect
  • Convex hull uses scipy's ConvexHull
  • Supports both single Polygon and MultiPolygon from alphashape results

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-29 09:48 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

content-creation

Pywayne Lark Bot

wangyendt
飞书/Lark 机器人 API 封装,提供完整的飞书机器人交互功能。适用于需要发送文本、图片、音频、文件、帖子、交互式、分享等各类消息的场景。
★ 0 📥 1,261
productivity

Nano Pdf

steipete
使用nano-pdf CLI通过自然语言指令编辑PDF
★ 275 📥 114,833
productivity

Weather

steipete
获取当前天气和预报(无需API密钥)
★ 445 📥 226,281