Skip to main content

图像缩放坐标映射、LiDAR 投影点选点与像素/点云导航核心算法库

Project description

lidar-image-pick-core

纯算法库,不绑定 Qt。用于把“图像缩放坐标映射、LiDAR 投影点选点、像素模式/点云模式方向导航”沉淀为稳定能力。

功能

  • 图像画布坐标与原图像素坐标互转
  • 一个像素下多个 LiDAR 投影点的完整候选返回
  • 像素模式方向移动
    • 先按原图像素 u/v +/- step
    • 若该像素无投影点,再最近邻吸附到真实点云像素
  • LiDAR 模式方向移动
    • ring/count 时优先按 ring + count 导航
    • ring 或缺可达目标时,自动降级为方向最近邻导航
  • PCD 输入支持
    • DATA ascii 直接解析
    • DATA binary / binary_compressed 需要安装 open3d

安装

pip install lidar-image-pick-core

需要 PCD 二进制读取时:

pip install "lidar-image-pick-core[pcd]"

快速开始

from lidar_image_pick_core import (
    CanvasTransform,
    PickIndex,
    ProjectedPointRecord,
    move_lidar,
    move_pixel,
    resolve_pixel,
)

points = [
    ProjectedPointRecord(point_id="p0", xyz=(1.0, 0.0, 10.0), pixel=(100, 50), ring=0, count=0),
    ProjectedPointRecord(point_id="p1", xyz=(1.2, 0.1, 10.0), pixel=(101, 50), ring=0, count=1),
    ProjectedPointRecord(point_id="p2", xyz=(1.0, 0.0, 11.0), pixel=(100, 50), ring=1, count=0),
]

index = PickIndex.build(points, image_size=(1920, 1080))

result = resolve_pixel(index, 100, 50)
print(result.points_at_resolved_pixel)   # 同像素下全部点

pixel_move = move_pixel(index, (100, 50), "left", step=1, snap=True)
print(pixel_move.requested_pixel, pixel_move.resolved_pixel)

lidar_move = move_lidar(index, "p1", "left")
print(lidar_move.active_point.point_id)  # p0

transform = CanvasTransform(
    image_width=1920,
    image_height=1080,
    canvas_width=1280,
    canvas_height=720,
    zoom_factor=2.0,
    pan_offset_x=0,
    pan_offset_y=0,
)
canvas_pt = transform.image_to_canvas(100, 50)
image_pt = transform.canvas_to_image(*canvas_pt)

主要接口

  • CanvasTransform
  • ProjectedPointRecord
  • PickIndex.build(projected_points, image_size)
  • load_structured_points_from_pcd(path)
  • project_points_with_callable(structured_points, project_xyz_to_pixel, image_size)
  • get_points_at_pixel(index, px, py)
  • find_nearest_projected_pixel(index, px, py, directional=None)
  • resolve_pixel(index, px, py, snap="exact_then_nearest")
  • move_pixel(index, current_pixel, direction, step=1, snap=True)
  • move_lidar(index, active_point_id, direction)
  • get_capabilities(index)

设计约束

  • 本库不依赖 D05 / D07,但接口兼容它们的常见数据形态
  • 本库不负责 UI 事件,只负责算法与结果结构
  • ring / count 时不崩溃,自动降级并返回 status/message

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lidar_image_pick_core-0.0.1.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lidar_image_pick_core-0.0.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file lidar_image_pick_core-0.0.1.tar.gz.

File metadata

  • Download URL: lidar_image_pick_core-0.0.1.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for lidar_image_pick_core-0.0.1.tar.gz
Algorithm Hash digest
SHA256 520a13a326f135b950f205fba6b301b93dbd2bca7852ffe23ce2ba619ff50166
MD5 d679487e0aadc6c7a35cd817889c9ab3
BLAKE2b-256 da07313fdc65a3d0c92545db77a22aa03ea948584cd48b912494f256dd0eb156

See more details on using hashes here.

File details

Details for the file lidar_image_pick_core-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for lidar_image_pick_core-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 85e4d8507410bbc848532746d7bbfd5c522d97ad02a75393780a927b61d7469a
MD5 efca517a0a39ca78376af9d033b46460
BLAKE2b-256 9e703693b97557e32707094b92606c65bee7be129c66b33cf8a6c0d33d9e17df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page