Always oversubscribe 4 tiles/thread in MLAS threading instead of detecting
mixed-core CPUs via CPUID, which never covers ARM big.LITTLE or Apple's
P/E cores. Matches the same tradeoff core/src/arithm_expr.cpp already
accepts for heterogeneous cores.
Also add Fusion.AttentionQKVGrouping{SeqMerge,BatchMerge}, which exercise
readQKVGrouping()/evalDims() against a real Shape/Gather/Mul/Concat chain
feeding the QKV Reshape, rather than injecting qkv_batch/qkv_seq directly
as a layer param like the existing AttentionLayer-level tests do.
dnn: fuse attention when a Q/K/V projection has no bias - #30284
The fused Attention layer needs the full QKV bias. Fill a missing projection bias with zeros in all three attention fusion paths, and leave the block unfused if a bias has the wrong length. The CLIP path dropped all three biases when one was missing, and the generic path read K/V bias blobs that may not exist. All three paths now emit a 1-D bias. Fixes the trOCR encoder.
some extra models and inputs added to opencv_extra: https://github.com/opencv/opencv_extra/pull/1433
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
dnn: fix blobRectsToImageRects when the image is not resized (5.x) - #30287
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work. 5.x port of #30243, as requested there. Related: #30042.
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable. Accuracy test added; no test data needed.
- [ ] The feature is well documented and sample code can be built with the project CMake. Not applicable to this bug fix.
### Problem
Port of #30243 to 5.x. `Image2BlobParams::blobRectToImageRect()` and `blobRectsToImageRects()` are identical on 5.x and have the same bug:
- When `Image2BlobParams::size` equals the image size, every output rect is `Rect(0, 0, 0, 0)`, in all three padding modes.
- When `size` is empty (the default, which `blobFromImageWithParams()` treats as "keep the image size"), the mapping divides by zero and returns `INT_MIN` coordinates.
```python
import cv2 as cv
p = cv.dnn.Image2BlobParams()
p.size = (640, 640)
p.paddingmode = cv.dnn.DNN_PMODE_LETTERBOX
print(p.blobRectToImageRect((10, 20, 30, 40), (640, 640)))
# (0, 0, 0, 0), expected (10, 20, 30, 40)
p.size = (0, 0)
print(p.blobRectToImageRect((10, 20, 30, 40), (640, 480)))
# (-2147483648, -2147483648, -2147483648, -2147483648), expected (10, 20, 30, 40)
```
### Change
Same change as #30243, cherry-picked without conflicts. `blobRectsToImageRects()` now follows the same two rules as `blobFromImagesWithParams()` on 5.x: an empty `size` means the image size, and when the sizes match the input rects are returned unchanged. The resize, crop-center and letterbox mappings are unchanged. It also includes the Doxygen `@note` on both functions requested in the #30243 review.
The new `blobRectToImageRect.no_resize` test covers both cases for all three padding modes, and checks that the blob built with the same parameters is pixel-identical to the image.
#30042 contains an equivalent pass-through for the equal-size case as part of a larger Model API change. This PR is the standalone fix, including the empty-size case. If #30042 lands first, the conflict should be limited to `blobRectsToImageRects()`.
### Testing
Built `opencv_test_dnn` and the Python bindings from this branch (base 5.x `6dc5ff5c1f`) on Ubuntu 26.04 (WSL2), GCC 15.2, Ninja, `BUILD_LIST=dnn,python3,ts`.
- `opencv_test_dnn --gtest_filter=blobRectToImageRect*`: 4 passed. With only the `dnn_utils.cpp` change reverted, the new `blobRectToImageRect.no_resize` fails in all six mode/size combinations (`[0 x 0 from (0, 0)]` for equal sizes, `INT_MIN` for empty size).
- `opencv_test_dnn --gtest_filter='blob*:*Image2Blob*:*imagesFromBlob*'`: 11 passed.
- `modules/dnn/misc/python/test/test_dnn.py`: 8 passed, 2 skipped; 6 failed only because their opencv_extra files are not present locally (`dnn/googlenet_0.png`, `dnn/street.png`, ...).
- The Python reproducer above prints `(10, 20, 30, 40)` for both cases with this branch (`5.1.0-dev`).
- No compiler warnings in the build; `git diff --check` clean.
- Full `opencv_test_dnn` was not run (needs opencv_extra test data).
dnn: accept TopK with K = 0 and fix broadcast eltwise ops in block layout - #30285
### TopK with K = 0
Detectors exported from TensorFlow (e.g. SSD MobileNet v1) sort the boxes kept by NMS
with TopK, where K is the number of kept boxes. On an image with no detections K = 0
and TopK2 failed with "dynamic K must be > 0". The ONNX spec asks for K > 0, but ONNX
Runtime accepts K = 0 and returns empty outputs; TopK2 now does the same.
### Broadcast eltwise ops in block layout
When every input of an eltwise op is in block layout (NCHWc), the op stays in block
layout even if one input has a single channel, e.g. BiRefNet's attention gating
`[1,1536,32,32] * [1,1,32,32]`. The single channel lives in lane 0 of its block, so 7 of
every 8 output channels were multiplied by padding, and the output shape lost its block
marking. The 1-channel input now has lane 0 copied into every lane before broadcasting,
and the output is marked as block with the full channel count.
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
The fusion read only num_heads and head_dim from the QKV Reshape target,
so a graph reshaping Q/K/V to [B, T*S, H, D] fused the same way as one
reshaping to [B*T, S, H, D], and the fused layer computed the second for
both, giving a wrong result for the first.
The fusion now records the first two target entries, the batch and the
sequence length the attention runs over, each as a constant times a
product of input dims, or as inferred. It reads constants and chains of
Shape, Gather, Mul, Unsqueeze, Squeeze and Cast (as in the SAM3 decoder).
If an entry is computed some other way, or Q, K and V disagree, the block
is left unfused. The layer evaluates the record against the input shape
and runs over that grouping, which is a view of the same contiguous
tokens. Without a record, as for the ONNX Attention op, the input must be
3D.
- test_misc.cpp: merge forward_outputs_are_private/_ort into one
TEST_P(Net_ForwardOutputsArePrivate, Accuracy) over EngineType,
guarding the ENGINE_ORT value with #ifdef HAVE_ONNXRUNTIME.
- 3rdparty/mlas/patches/0001-mlasi-opencv-threading.diff: refresh the
stale hunk header. The second hunk's "+" line number had drifted by
one (1677 -> 1678) because an unrelated, already-merged MinGW/GCC
portability fix added a line earlier in mlasi.h; verified by
reconstructing the pristine upstream file at the documented base
commit and confirming the patch now applies with no offset/fuzz.
Pass the lambda directly to parallel_for_ instead of binding it to a
named fn variable first, matching the other parallel_for_ call sites
in this function. Requested by abhishek-gola on #30277.
Backport #30165 to 5.x branch - #30169
Port of https://github.com/opencv/opencv/pull/30165
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [X] The PR is proposed to the proper branch
- [X] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
imgproc: fix out-of-bounds read in OpenCL color kernels for 3-channel input 🤖🤖🤖 - #30274
YUV2RGB, RGB2YCrCb, YCrCb2RGB and the PIX_PER_WI_X != 2 path of
RGB2YUV_YV12_IYUV load each source pixel with vload4 but only use the
first three components. With SCN == 3 the load of the last pixel reads
one element past the end of the source buffer, which may result in a
GPU page fault.
Use vload3, as RGB2YUV already does, and drop the now unused
DATA_TYPE_4 macro.
The same issue is fixed in RGB2XYZ, XYZ2RGB, BGR2Lab, Lab2BGR, RGB2HSV,
HSV2RGB, RGB2HLS, HLS2RGB and RGB2RGB5x5, which load each source pixel
with vload4 but only use the first three components when SCN == 3.
Add an OpenCL cvtColor test with a contiguous 3-channel source whose
size is a multiple of 1 MiB, so the last pixel ends exactly at the end
of the buffer, covering 8U and 32F conversions and RGB2RGB5x5.
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
dnn: fix ONNX conformance failures in layers and the graph engine - #30181
Fixes wrong results found by running the ONNX backend-scoreboard conformance suite (onnx 1.23.2) against the new DNN engine. No new ops are added; these are all ops OpenCV already claims to support but computed incorrectly.
Updated ONNX coverage is: `[scoreboard] passed=1740 failed=21 skipped=272 total=2033 (85.6% passed)`
**Graph engine / importer**
- Reshape+Reshape fusion now only fires when the outer shape is known and has no `0` entries, since a `0` copies a dim from the inner Reshape's output.
- Scan slices rank-1 inputs to scalars, so scalar loop-carried state keeps rank 0.
- Rank-0 tensors read from ONNX keep rank 0 instead of becoming 1x1.
- When a model is refused, `setInput()` now reports the actual import failure (including unknown ops that throw early) instead of a misleading "missing blob" error.
**Attention**
- Softcap is applied before the bias/mask, as the spec does, so masked keys no longer leak probability.
- `qk_matmul_output_mode` 1 and 2 now return the right tensors (checked against onnxruntime; the old denylist entries blaming the reference data were wrong).
- Attention-25 `left_window_size` / `right_window_size` are supported, including together with `attn_mask`.
- A fully masked row now gives all zeros instead of a uniform distribution.
**Layers**
- GRU: `direction="reverse"` is honoured.
- LSTM reverse: `Y_h` / `Y_c` are taken from the correct time step.
- SpaceToDepth: opset-28 `mode` (CRD / DCR) is supported.
- MaxPool: `storage_order` is respected for the indices output.
- OneHot: out-of-range indices produce an all-`off_value` row instead of wrapping.
- Mod with `fmod=0`: no longer truncates through int (wrong for float, lossy for int64).
- ReduceMax / ReduceMin on an empty bool set return the correct identity.
- Swish: `alpha` is respected (CPU and OpenCL).
- Quantize/DequantizeLinear: scale and zero_point may differ in shape when they're broadcast-compatible (e.g. rank-0 scale with `[1]` zero_point).
- BitShift: signed integer types are supported.
**Tests**
- 12 conformance tests removed from the denylists, a few OpenVINO filter entries added, and new 1D layer tests for the fixes.
- Full C++ conformance passes (5376/5376); `opencv_test_dnn` has no new failures compared with 5.x.
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
The output has v_hidden values per token, but getMemoryShapes() sized it
from the input width, so a V wider than the input wrote past the output
buffer. Size it from v_hidden for both output ranks, and test V widths
below, equal to and above the input width.
drop ND prefix from the functions - #30207
Merge pull request #30207 from abhishek-gola:core-drop-nd-suffix
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
3rdparty(libtiff): expand WebP compression support for bundled libtiff(5.x) - #30264
## Overview
This pull request enables WebP compression support in the bundled `libtiff` build for OpenCV.
Previously, even when both the bundled `libtiff` and libwebp were enabled, TIFF-WebP compression was unavailable because WebP support was not hooked up in `libtiff`.
Port from https://github.com/opencv/opencv/pull/30231
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
- Attention Q/K/V projection: pack each (Q/K/V, head) weight slice with
MLAS and run all per-head GEMMs in one multithreaded
mlasSgemmPackedBatch() call; the fastGemm loop stays as the fallback.
- MLAS: split each operation into 4 tiles per thread on hybrid CPUs.
- forward(): hand the private output Mats to the caller instead of
copying them again.
- Attention: accept [..., S, C] input (SAM3 decoder).
On ARM with CV_SIMD_16F, getMulFunc_, getDivFunc_, and getAddWeightedFunc_
used float16 for 8-bit integer SIMD kernels, leading to precision loss
and overflow (> 65504). Switch to float32 to match x86 and ensure precision.
imgproc: fix segfault in connectedComponents on zero-size input - #30225
`cv::connectedComponents` and `cv::connectedComponentsWithStats` crash with SIGSEGV when passed an image with a zero-length dimension (e.g., shape `(0, 400)`), instead of raising a proper error. All other OpenCV functions handle empty input gracefully.
The root cause is that the labeling algorithms dereference pointers based on image dimensions without first checking for empty input, causing a null dereference when `rows == 0` or `cols == 0`.
The fix adds `CV_Assert(!img.empty())` at the entry point of both public API functions, so callers receive a `cv::Exception` / `cv2.error` consistently with the rest of the OpenCV API (`findContours`, `cvtColor`, `inRange`, etc.).
A regression test `Imgproc_ConnectedComponents.empty_input_29854` is included, covering all three zero-dimension shapes (`{0,400}`, `{400,0}`, `{0,0}`) for both `connectedComponents` and `connectedComponentsWithStats`.
Reproducer:
```python
import numpy as np, cv2
mask = np.zeros((0, 400), dtype=np.uint8)
cv2.connectedComponentsWithStats(mask) # was: SIGSEGV; now: cv2.error
```
Fixes#29854
Extends cv::videoio_registry::enumerateDevices() (#29843) to GigE and
USB3 Vision cameras handled by Aravis. The backend already resolves a
capture index to an entry of the Aravis device list, so the same list is
reported, which keeps VideoDeviceInfo::cam_idx valid for
cv::VideoCapture(idx, CAP_ARAVIS).
Device name is composed of vendor, model and the Aravis device ID, so
cameras of the same model remain distinguishable; all three strings are
optional and the registry falls back to "cam: <index>" if none of them
is available.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
videoio: Added camera device enumeration - #29843#29843
**Resolves** [Issue#4269](https://github.com/opencv/opencv/issues/4269)
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
Added Gaussian Splat Renderer Support - #29729
Adds 3D Gaussian Splatting support to `ptcloud`: a loader for trained scenes and a `viz3d` renderer that draws them alpha-blended and depth-sorted alongside existing opaque geometry.
### Result
<img width="1842" height="811" alt="splat" src="https://github.com/user-attachments/assets/abfa5c01-6dbb-4367-b426-a618e3748649" />
[.splat source](https://huggingface.co/cakewalk/splat-data/resolve/main/train.splat)
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
calib: make Schur complement solver deterministic - #30175
The Schur-complement LM solver's Jacobian accumulation previously summed per-image contributions into shared `U`/`ea` matrices under a mutex, so results depended on thread-scheduling order. This partitions images into a fixed number of parallel "buckets" (nparts, capped at 16), accumulates each bucket independently without locking, then reduces them serially removing the mutex and making results bit-identical regardless of thread count.
### Benchmark: CalibrateCamera
Median of 5 runs, native 5.x vs this branch:
| Threads | 5.x median (ms) | This branch median (ms) | Change |
|---|---|---|---|
| 32 | 838.8 (777.7–855.6) | 578.4 (574.5–583.2) | 1.45× faster |
| 1 | 1233.8 (1225.8–1236.8) | 1214.6 (1213.1–1214.8) | 1.6% faster |
Single-thread time is essentially unchanged, as expected removing the mutex has no effect without contention. The gain comes from splitting the Jacobian accumulation (`U`/`ea`) into lock-free per-bucket partials instead of serializing every image's update behind one mutex, which scales much closer to linear with thread count.
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
imgproc: reject unsupported depths in OpenCL threshold - #30252Fixes#30251
### Problem
`ocl_threshold()` does not check the input depth. On 5.x a `UMat` of depth `CV_64U`, `CV_64S` or `CV_32U` gets through, because `ocl::typeToStr()` maps those depths to valid OpenCL types and the kernel compiles. The function then indexes the 8-entry `min_vals[]` table with a depth of 10, 11 or 12, which reads past the end of the array, and skips the `depth <= CV_32S` flooring of `thresh`.
The CPU implementation rejects these depths with `StsUnsupportedFormat`, so the same call throws for a `Mat` and returns an image for a `UMat`, depending on whether an OpenCL device is available.
`CV_16BF` and `CV_Bool` did not reach the table, but failed with `Assertion failed (result) in typeToStr` instead of `StsUnsupportedFormat`.
### Fix
Return `false` from `ocl_threshold()` for every depth above `CV_64F`, before the kernel is built. Those inputs now fall through to the CPU path, which reports `StsUnsupportedFormat` as it does for `Mat` input.
The depths the OpenCL branch accepted in 4.x (`CV_8U` to `CV_64F`) behave as before.
### Tests
`Imgproc_Threshold_Unsupported_Depth.umat` is parameterized over `CV_16F`, `CV_16BF`, `CV_Bool`, `CV_64U`, `CV_64S`, `CV_32U` and `THRESH_BINARY`, `THRESH_TRUNC`. It checks that `threshold()` on `Mat` and `UMat`, and `thresholdWithMask()` on `UMat`, throw.
On current 5.x with an OpenCL device (Apple M1 Pro, OpenCL 1.2) it fails for `threshold()` on `UMat` with `CV_64U`, `CV_64S` and `CV_32U`. With this patch it passes with OpenCL enabled and with `OPENCV_OPENCL_DEVICE=disabled`. The other `threshold()` tests in `opencv_test_imgproc`, including the OpenCL ones, still pass locally (the `Imgproc_AdaptiveThreshold` tests were not run, they need `opencv_extra` data).
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
core: reduceND, used by the DNN Reduce2 layer - #30157
Split out of #30082, which now carries only the resize half.
Adds `cv::reduceND`, which reduces an n-dimensional array over a set of axes with any of the `ReduceTypes`, extended with `REDUCE_PROD`, `REDUCE_L1`, `REDUCE_L2`, `REDUCE_LOG_SUM` and `REDUCE_LOG_SUM_EXP`. `cv::reduce` accepts n-dimensional input through it.
`sum`, `mean` and `minMaxIdx` now share one parallel driver (`stat_parallel.hpp`), so they parallelize over large arrays the same way `reduceND` does.
The new graph engine's `Reduce2` layer calls `cv::reduceND` instead of its own kernels, so `reduce2_kernels.simd.hpp` and the hand-written reduction loops in `reduce2_layer.cpp` go away.
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
calib document fix - #30208
Documentation changes - three doxygen blocks in `modules/objdetect`.
- **`findChessboardCorners`** (PR#22083): whether the returned order pins down a unique
physical corner depends on the **parity** of the two `patternSize` dimensions, not on
whether they differ. Quads are built from the dark squares only (`calibinit.cpp:755`
`THRESH_BINARY`, `:796` white frame, `:1919` holes-only), so a rotation is admissible
only if it maps dark squares onto dark squares. For `patternSize` of w x h interior
corners the squares form a (w+1) x (h+1) grid, so 180° preserves the colouring exactly
when w and h share parity:
| `patternSize` | distinct origins | ambiguity |
|--------------------------------|------------------|---------------|
| different parity (9x6, 8x5) | 1 | none |
| same parity, w != h (8x6, 7x5) | 2 | 180° |
| w == h (7x7, 8x8) | 4 | 90° |
The square case is not colour: the transpose at `calibinit.cpp:1745` is a no-op when
`width == pattern_size.width`, so the detector cannot tell rows from columns. Verified
over 24 in-plane rotations and 60 perspective views per board, zero detection failures;
inverting the square colouring moves the origin but not the count.
Practical consequence is the reverse of what was documented: the common 9x6 board is
unambiguous, while this docstring's own sample `Size patternsize(8,6)` is not. The note
now recommends a board whose dimensions differ in parity first, then
#findChessboardCornersSB + `CALIB_CB_MARKER`, then ChArUco. Still harmless for
intrinsics (each view absorbs the rotation into its own pose); still breaks hand-eye.
- **`findCirclesGrid`** (PR#7312): the returned points are the keypoint locations reported
by `blobDetector` as-is, without refinement - the parameter is a `FeatureDetector` and
`SimpleBlobDetector` is only the default, so the points are not necessarily moment
centroids. Under perspective the apparent centre of a projected circle can be displaced
from the projection of the physical centre; the displacement vanishes when the board is
parallel to the image plane and is not removed by fitting an ellipse. Points at the
`blobDetector = NULL` path for supplying corrected centres. Describes the bias
qualitatively rather than quoting a fixed estimate.
- **`setLegacyPattern` / `detectBoard`** (PR#23152, PR#29636): the flag is a no-op on
odd-row boards, and a wrong setting fails silently - markers detected, zero corners,
only a `CV_LOG_DEBUG` line; notes that calib.io boards use the legacy layout and aligns
the 4.6.0 version wording across both headers.
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake