Migrating to 0.18.0
Breaking for Rust callers of the facade. The detect_* and blur
functions borrow a GrayImageView instead of taking an image::GrayImage,
and the five detect_*_best sweeps share one set of rules. The Python and
WASM detection calls keep their signatures; only the sweep error behaviour
changes there.
Labels change in two ways (see the CHANGELOG): dense, strongly distorted chessboards gain corners, and a ChArUco fragment is merged only when its geometry agrees with the rest of the board.
The facade takes &GrayImageView
Every calib_targets::detect::* and calib_targets::blur::* function that
took &image::GrayImage now takes &GrayImageView<'_>. Borrow your image
with detect::gray_view — no copy is made:
// Before
let det = calib_targets::detect::detect_chessboard(&img, &chess_cfg, ¶ms);
// After
use calib_targets::detect::{detect_chessboard, gray_view};
let det = detect_chessboard(&gray_view(&img), &chess_cfg, ¶ms);
Raw buffers: detect::gray_image_from_slice(w, h, &px) is replaced by
detect::gray_view_from_slice(w, h, &px), which borrows px. A zero width or
height is now rejected as DetectError::InvalidGrayDimensions (it used to run
and miss); the detect_*_from_gray_u8 helpers inherit this.
detect and blur no longer need the image feature. With
default-features = false you build GrayImageView yourself; the image
feature only adds gray_view, preprocess and the image re-export, and it
no longer pulls in chess-corners.
detect_*_best sweeps
All five sweeps (detect_chessboard_best, detect_charuco_best,
detect_puzzleboard_best, detect_puzzlepole_best,
detect_marker_board_best) follow one contract:
| Situation | 0.17 | 0.18 |
|---|---|---|
| Empty config list | a miss (NoDetection, CharucoDetect(NoMarkers), …) | DetectError::EmptySweep { op } (misuse, is_not_found() == false) |
| An invalid config in the list | skipped | the sweep stops and returns that error |
| Two configs tie on the score | chessboard / marker board: last wins; others: first wins | first wins everywhere |
Order sweep presets by preference: the earlier config wins a tie. Match on
DetectError::EmptySweep if you build config lists dynamically (the enum is
#[non_exhaustive], so existing _ arms keep compiling).
Python / WASM: detect_*_best(image, []), or a list containing an invalid
config, now raises ValueError / throws instead of returning None / null.
Smaller changes
MarkerBoardDetector::newreturnsMarkerBoardParamsError; the facade reports it asDetectError::MarkerBoardParams(wasDetectError::ChessboardParams).- ChArUco
MarkerDetection::scoreisexp(mean bit log-likelihood)in(0, 1](it was a sigmoid that never exceeded 0.5). Re-check any threshold you apply to it. PuzzlePoleDetector::newrefusesmin_circumference_span < 5ormin_axial_span < 8(PuzzlePoleDetectError::WindowBelowFloor): smaller windows admit placements that provably alias.calib_targets_core::axis_estimate_to_next(axis)→LocalAxis::from(axis).- Binaries behind features:
cargo run -p calib-targets-puzzleboard --features tools --bin …for the code-map tools,--features package-archivefor the FFIpackage-release-archive. projective-grid0.15:expert::lattice::GRID_TRANSFORMS_D4is removed in favour ofD4_TRANSFORMS, which now has that order. Code that indexesD4_TRANSFORMS[k]directly gets a different transform fork = 1, 3.calib_targets_core::GRID_TRANSFORMS_D4keeps its values and order.
Migrating to 0.17.0
Breaking only for rarely used Rust surface. 0.17.0 removes three items
that nothing in the workspace used. Code that calls the detect_* functions
or the detectors, and reads their results, needs no change. The Python
package, the WASM package and the C ABI (6.0.3, no type or layout change) have
no API change.
Labels change in one way: frames that used to deliver wrong labels on boards blurred past readability now decline (see the CHANGELOG).
RectifiedView and RectToImgMapper are gone from calib-targets-core
They were result carriers that no function in the workspace produced. The chessboard crate builds rectified views and returns its own types:
| Need | Call | Returns |
|---|---|---|
| One homography for the whole board (negligible lens distortion) | calib_targets_chessboard::rectify_from_chessboard_result(&view, &detection, px_per_square, margin_squares) | RectifiedBoardView (rect, h_img_from_rect, h_rect_from_img, grid extent) |
| A per-cell homography mesh (tolerates lens distortion) | calib_targets_chessboard::rectify_mesh_from_grid(&view, &corners, &inliers, px_per_square) | RectifiedMeshView (rect, origin, cells_x, cells_y, …) |
Both are reachable through the facade as calib_targets::chessboard::…. A
RectToImgMapper::Global { h_img_from_rect } corresponds to
RectifiedBoardView::h_img_from_rect; a RectToImgMapper::Mesh to a
RectifiedMeshView.
square_predict_grid_position is gone
It forwarded to projective-grid’s lattice predictor. Call the predictor
directly (this needs projective-grid as a dependency of your own) and read
the prediction’s position:
// Before
use calib_targets_core::square_predict_grid_position;
let p = square_predict_grid_position(&grid, idx);
// After
use projective_grid::{expert::lattice::predict_grid_position, LatticeKind};
let p = predict_grid_position(&grid, idx, LatticeKind::Square).map(|pred| pred.position);
The prediction also carries n_axis_pairs, the number of complete opposite
neighbour pairs it averages.
The chessboard crate’s dataset feature is gone
calib-targets-chessboard/dataset enabled diagnostics and an unused
dependency. Enable diagnostics instead:
calib-targets-chessboard = { version = "0.17", features = ["diagnostics"] }