Changes since version 2.13.0¶
New Features¶
CoordinateMapper— a pixel↔world mapping protocol inpytanga.viz.camera(to_world(u, v)/to_pixel(point)) with aPlanarMapper(the previousz = 0"pixel == world XY" behavior) and aCalibratedPlaneMapper(casts a pinhole ray and intersects a plane perpendicular to the optical axis at a fixeddepth).LabelMeStore(mapper=…)threads it through every pixel↔world call site, so labelme shapes can live in a calibrated 3D scene instead of a flat pixel plane.- Robust labelme loading —
LabelMeStore.load/loadsnow return aLabelMeLoadResultandadd_shapes/iter_objectsreturn(result, errors); malformed shapes (e.g. a one-point"rectangle") are skipped and reported instead of crashing or silently dropping. - Lossless labelme round-trip —
dumps/saveemit labelme's own key order withindent=4and no coordinate rounding (opt in viaLabelMeStore(coordinate_precision=…)); themaskfield is now preserved. LabelShapeunification — the example app'sLabeledShape(act/style/label) is folded intoLabelShape, withmaskround-tripped andstyle/actkept in memory only.- Calibrated labeling example —
py/examples/apps/calibrated_labeling_app.pylabels a bundled T-LESS image in two panes of one world scene (calibrated camera view on the left, frustum + shapes on the right) via aCalibratedPlaneMapper. - Plane-aware
ActImagePlane— the interactive image plane is generalized to draw on any plane defined by aCoordinateMapper(CoordinateMapper.plane()exposes the plane's point + normal). Its drag anchor is a generic ray↔plane intersection and its drag mode isVIEW_PLANE, so drag-to-draw works on a calibrated camera plane (perpendicular to the optical axis) as well as the flat image canvas — with no frontend change. -
Calibrated drag-to-draw —
calibrated_labeling_app.pygains a toolbar +DragPreviewthat draws rectangle/circle/line shapes on the calibrated pane, adding them to the shared world scene (visible in both the calibrated and world views). -
Per-pane
InteractionSurface— a reusable interaction primitive: aSceneViewpane plus aCoordinateMapper(which defines a plane viaplane()) plus pane-levelon_drag_start/on_drag/on_drag_end/on_clickhandlers, with no scene entity. The frontend emits drag/click events for the pane's empty space by intersecting the mouse ray with the serialized{point, normal}, and the backend resolves world positions on the plane.SceneView(surface=…)binds it;SceneView(read_only=True)suppresses surface +Act*interaction on a pane while navigation keeps working. CalibratedSurface— anInteractionSurfaceon the ⟂-optical-axis plane at a fixeddepth(CalibratedPlaneMapper).- Calibrated image labeling —
calibrated_labeling_app.pynow supports drag-to-draw rectangle, circle, line, ellipse, and polygon, plus click-to-place point, on a calibrated pinhole-camera pane. - Shape selection — clicking a shape reveals its translate/rotate handles and recolors it yellow; clicking elsewhere hides the handles and restores the color. Delete/Backspace removes the selected shape and Escape deselects (mirroring the image labeler).
- 3D orbit zoom limits —
CameraConfig3dgains optionalmin_distance/max_distance(world units) bounding the orbit dolly; when unset, the frontend derives them from the camera's initial distance to its target, so small (e.g. metre-scale) scenes can zoom in instead of being clamped by the old fixedminDistance = 1. - File-chooser filename entry + save mode — the
FileChooserDialogfooter is now an editable filename field: typing it filters the selected folder's listing with a case-insensitive glob, and a newexisting_onlyflag (default true) turns off the must-exist requirement for Save As… (which appends.jsonto a filename with no extension).
Breaking Changes¶
LabelMeStore.load/loadsnow returnLabelMeLoadResult(wasLabelMeDocument);add_shapes/iter_objectsreturn(result, errors).LabelMeStore.dumps/saveno longer round coordinates to 2 decimals or sort keys, and indent with 4 spaces.ImageCanvas.act_plane→ImageCanvas.surface— the flat image canvas is refactored onto anInteractionSurface; theImageViewis now visual-only (no longer raycastable), and the interactive surface isImageCanvas.surface.
Bug Fixes¶
- Calibrated drag-to-draw — the calibrated labeling example no longer drops
an interactive
Planeinto the shared world scene (which broke navigation and was interactive in both panes). Drag-to-draw is bound to the image pane's surface only, and the overview pane is read-only. - Screen-space point markers — circle/icon point markers no longer apply a
pixel-unit
size·0.1z-lift, which had displaced them off the image plane onto the camera plane. - Icon handle glyphs — translate/rotate (and other icon-point) handles now
wait for the Material Symbols ligature font to finish loading before drawing
their canvas texture, so they render as move/rotate glyphs instead of the raw
ligature text (
open_with,rotate_right). - Zoom-correct drag scale — pixel→world drag deltas now use the pinhole
frustum (
screenWorldScale) instead of the stalecamera.fov. - Toolbar mode highlight — the calibrated app's toolbar reflects the active draw mode.
- Scale-correct resize limits — circle/ellipse radius and rectangle size clamps are expressed in image pixels (0.5 px minimum) and converted to world units via the mapper, so resizing behaves identically in the 2D image labeler and the calibrated labeler.
- Polygon auto-close tolerance — the endpoint-snap tolerance is derived from the handle size in world units instead of raw pixel values, so endpoints no longer snap together at calibrated scales.
- Hidden handles are inert — hiding the translate/rotate handle also disables its interaction.
- Ellipse degenerate radius — the ellipse renderer no longer treats a zero radius as "unset" (which had rendered a huge default ellipse at the start of a drag); a zero radius now clamps to the minimum.
- Click-created point offset — click events now carry the picking ray and
screen_positionin a common canvas-local pixel frame, and the backend resolves the click anchor from that ray (instead ofpixel_ray), so a click-to-place point lands exactly under the cursor, like drag-created shapes.
Refactor¶
CoordinateMapper.world_units_per_pixel()— the image-pixel↔world size scale now lives on the mapper (PlanarMapper→ 1.0,CalibratedPlaneMapper→depth/fx), replacing the ad-hocdepth/fxliterals in the label apps.LabelMeStoreis a pure data store — it no longer createsActSceneObjectcomposites (_act_from_shapeand theactive=flag are gone);iter_objects(doc)/add_shapes(handle, doc)map JSON ↔ plain geometry (Point,Line,Circle,Ellipse,Rectangle2D,PointPath), and the label apps wrap those entities into interactive acts via their own_act_from_entity.pixel_scaleon the base —_pixel_scale/set_pixel_scalemoved from_ActWithHandlestoActSceneObject(every act, includingActPoint, now carries the world-units-per-pixel scale), removing thehasattrguard in the label apps.