图像缩放坐标映射、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)
主要接口
CanvasTransformProjectedPointRecordPickIndex.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
520a13a326f135b950f205fba6b301b93dbd2bca7852ffe23ce2ba619ff50166
|
|
| MD5 |
d679487e0aadc6c7a35cd817889c9ab3
|
|
| BLAKE2b-256 |
da07313fdc65a3d0c92545db77a22aa03ea948584cd48b912494f256dd0eb156
|
File details
Details for the file lidar_image_pick_core-0.0.1-py3-none-any.whl.
File metadata
- Download URL: lidar_image_pick_core-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85e4d8507410bbc848532746d7bbfd5c522d97ad02a75393780a927b61d7469a
|
|
| MD5 |
efca517a0a39ca78376af9d033b46460
|
|
| BLAKE2b-256 |
9e703693b97557e32707094b92606c65bee7be129c66b33cf8a6c0d33d9e17df
|