1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00
Commit Graph

35668 Commits

Author SHA1 Message Date
Samaresh Kumar Singh 7224bced8b Fix #27961: Support reproducible builds by making host system version optional
Add BUILD_INFO_SKIP_SYSTEM_VERSION option to exclude the host kernel version
from build outputs, enabling reproducible builds across systems with different
kernel versions.

Changes:
- Modified CMakeLists.txt to conditionally include CMAKE_HOST_SYSTEM_VERSION
  in the build platform status based on BUILD_INFO_SKIP_SYSTEM_VERSION flag
- Updated 3rdparty/tbb/CMakeLists.txt to set TBB_HOST_VERSION conditionally
- Modified 3rdparty/tbb/version_string.ver.cmakein to use the new variable

When BUILD_INFO_SKIP_SYSTEM_VERSION=ON is set, the host system version is
excluded from both the CMake status output and the TBB version strings,
producing identical binaries on equivalent build systems regardless of
kernel version differences.

Default behavior is unchanged (version included) for backward compatibility.

Fixes #27961
2025-11-08 09:16:11 -06:00
Ismail Abou Zeid 5fb4ce482c Merge pull request #27950 from ismailabouzeidx:feat/estimate-translation2d
[calib3d] Add estimateTranslation2D() #27950

Merge with opencv_extra PR: opencv/opencv_extra#1286

### **Description**

This PR adds a new API, `cv::estimateTranslation2D()`, to the **calib3d** module.  
It computes a **pure 2D translation** between two sets of corresponding points using robust methods (`RANSAC` and `LMedS`).  
The function mirrors the interface and behavior of `estimateAffine2D()` and `estimateAffinePartial2D()`, but constrains the transformation to translation only.

This model is particularly useful for cases where the motion between images is purely translational, such as:
- Aerial stitching and planar mosaics.  
- Image alignment in fixed-camera systems.  
- Lightweight pipelines where affine or homography models are unnecessarily complex.

The implementation introduces a new internal class `Translation2DEstimatorCallback` and integrates seamlessly into OpenCV’s existing robust estimation framework (`PointSetRegistrator`).

---

### **Key Features**
- Implements `cv::estimateTranslation2D()` in the `calib3d` module.
- Supports robust methods **RANSAC** and **LMedS**.  
- Adds accuracy and performance tests.  
- Provides full **C++ and Python bindings**.  
- Includes **Doxygen documentation** consistent with OpenCV’s standards.  
- Verified correctness across noise, outlier, and datatype variations.

---
### **Testing & Verification**

**Unit Tests** (`modules/calib3d/`)

- **Minimal sample:**  
  `test1Point` validates that a single correspondence recovers the correct translation under both **RANSAC** and **LMedS** across 500 randomized trials.  
- **Robustness to noise and outliers:**  
  `testNPoints` generates 100 correspondences, injects noise and outliers (≤40% for RANSAC, ≤50% for LMedS), and verifies that:  
  - Estimated **T** closely matches ground truth (`cvtest::norm(..., NORM_L2)`).  
  - Inlier mask consistency and correctness are maintained.  
- **Datatype conversion:**  
  `testConversion` checks mixed input datatypes (integer → float) to ensure correct conversion and consistent results.  
- **Input immutability:**  
  `dont_change_inputs` confirms that input arrays remain unchanged after function execution, mirroring affine behavior.

**Performance Tests** (`modules/calib3d/`)

- `EstimateTranslation2DPerf` benchmarks **RANSAC** and **LMedS** using:  
  - Point counts: 1000  
  - Confidence levels: 0.95  
  - Refinement iterations: 10, 0  
  
These tests confirm **numerical stability**, **performance scaling**, and **consistency** across datatypes and noise levels.

---
### 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 (`4.x`)
- [x] There is a clear description, motivation, and validation summary in this PR
- [x] There are accuracy and performance tests in the calib3d module
- [x] The feature is well documented and sample code can be built with CMake
- [x] The feature has Python bindings and verified documentation output
- [x] There is test data or sample code in the opencv_extra repository (if applicable)
- [ ] There is a reference to the original bug report or related issue (if applicable)
2025-11-08 17:27:54 +03:00
Alexander Smorkalov 9921531fa4 Merge pull request #27976 from asmorkalov:as/size_t_fix_win32
Fixed ptrdiff_t cast on windows 32-bit #27976

### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
2025-11-08 17:07:36 +03:00
Alexander Smorkalov 6862afb2c1 Merge pull request #27977 from asmorkalov:as/proper_ffmpeg_diagnostic_windows_arm
Fixed pre-built ffmpeg diagnostics on Windows for ARM. #27977

### 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
2025-11-08 11:24:24 +03:00
sirudoi 881774d872 Merge pull request #27930 from sirudoi:4.x
Add macOS support for Orbbec Gemini330 camera #27930

### Description of Changes
Adds macOS support for Orbbec Gemini330 in videoio by integrating OrbbecSDK v2. Completes the non-macOS work in [#27230](https://github.com/opencv/opencv/pull/27230).

#### Motivation

[#27230](https://github.com/opencv/opencv/pull/27230) skipped macOS. On macOS, UVC alone lacks required device controls; OrbbecSDK v2 provides them.

#### Key Change
 - macOS: fetch/link OrbbecSDK v2.5.5 (replaces v1.9.4).
 - videoio (macOS): switch OrbbecSDK API usage from v1 to v2.

### 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] The feature is well documented and sample code can be built with the project CMake
2025-11-07 10:36:11 +03:00
Pierre Chatelier 9fc556a83e Merge pull request #27366 from chacha21:arrowedLine_clipped
Try to fix distant points to save time when ThickLine() calls FillConvexPoly() #27366

Proposal for #27365

cv::clipLine() is useful, but one should take care of a margin to preserve line caps.

### 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
- [ ] 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
2025-11-07 10:34:52 +03:00
Alexander Smorkalov 426aa598e7 Merge pull request #27960 from vrabaud:protolite
Allow protobuffer message to be compiled with LITE_RUNTIME
2025-11-06 10:06:15 +03:00
Vincent Rabaud 1691a2355c Allow protobuffer message to be compiled with LITE_RUNTIME
When adding "option optimize_for = LITE_RUNTIME;" to proto
messages, they are compiled as lighter MessageLite (the base class
of Message).

Those lighter messages do not allow for reflection though:

https://developers.google.com/protocol-buffers/docs/reference/cpp-generated

This fixes https://github.com/opencv/opencv/issues/20275
2025-11-05 14:42:20 +01:00
abhijeetraj10-web 2f22bdf477 Merge pull request #27959 from abhijeetraj10-web:fix-patchNaNs-doc
Clarified supported types in cv::patchNaNs() documentation #27959

### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake

Updated the docs for cv::patchNaNs() to specify that both CV_32F and CV_64F types are supported. Fixes incomplete information.
2025-11-05 14:42:12 +03:00
Alexander Smorkalov d3d247f1e3 Merge pull request #27962 from Tuchis:fix-fisheye-documentation
Remove mention of 'tangential lens distortion' from fisheye documentation.
2025-11-05 12:22:45 +03:00
Alexander Smorkalov ec60a98ac6 Merge pull request #27963 from vrabaud:js
Fix generation when returned class and function are in a namespace
2025-11-05 11:10:36 +03:00
Vincent Rabaud f984d3bdc7 Fix generation when returned class and function are in a namespace
This is to fix js generation at HEAD with ximgproc.
2025-11-04 11:17:29 +01:00
Vladyslav Humennyy f692304c29 Remove mention of 'tangential lens distortion' from fisheye documentation.
In `fisheye::initUndistortRectifyMap` states, that the function 'compensate radial and tangential lens distortion'. But in fact, fisheye camera model in OpenCV does not uses tangential distortion. It uses only radial distortions, with 4 distortion k_1, k_2, k_3, k_4, which all are radial. In the code of the function all of those koeficients indeed are used as radial lens distortion coefficients. Possible reason of that issue is similar documentation of pinhole camera, that as first four coefficients uses 2 radial and 2 tangential lens distortion coefficients - k_1, k_2, p_1, p_2.
2025-11-04 11:16:59 +02:00
Alexander Smorkalov 01f9bdae4c Merge pull request #27723 from fanchenkong1:fastconv-wasm-scalar-opt
DNN: Add large scalar fastconv kernel for WASM/no-SIMD build
2025-10-31 22:50:41 +03:00
Alexander Smorkalov 5c73895cba Merge pull request #27949 from cudawarped:fix_cudart_dependency
[cuda] Add cudart target to all modules which use CUDA
2025-10-31 22:43:45 +03:00
Alexander Smorkalov 3516c57c81 Merge pull request #27944 from DDmytro:ecc-sanity-update
perf(video): add sanity checks and update ECC baselines for grayscale and color inputs.
2025-10-30 22:16:27 +03:00
Alexander Smorkalov 0c10aecacd Merge pull request #27945 from MaximSmolskiy:add_comments_for_undistortPoints
Add comments for undistortPoints
2025-10-30 16:11:11 +03:00
Alexander Smorkalov c69e20a495 Merge pull request #27948 from vrabaud:c_headers
Get code to compile without FFmpeg's libavdevice
2025-10-30 16:10:13 +03:00
cudawarped 6adb985679 [cuda] Add cudart to all modules which use it 2025-10-28 17:26:13 +02:00
Alexander Smorkalov d7f6201219 Merge pull request #27939 from Kumataro:fix27938
openexr: suppress -Wnontrivial-memcall warnings
2025-10-28 13:31:03 +03:00
Vincent Rabaud 3a4a88c116 Get code to compile without FFMPEG's libavdevice 2025-10-28 10:46:47 +01:00
MaximSmolskiy 2faff661c6 Add comments for undistortPoints 2025-10-28 03:13:16 +03:00
Dmytro Dadyka 37497fa2e3 perf(video): add sanity checks and update ECC baselines for grayscale and color inputs 2025-10-28 01:35:26 +02:00
Kumataro f836f67203 openexr: suppress -Wnontrivial-memcall warnings 2025-10-26 10:01:40 +09:00
Alexander Smorkalov 52393156c8 Merge pull request #27524 from DDmytro:multichannel_ecc
Extend findTransformECC and computeECC to support multichannel input (1 or 3 channels)
2025-10-24 11:24:15 +03:00
Stefan Dragnev 12b64b0e2a Merge pull request #27927 from tailsu:tailsu/tiff-error-handler
tiff: use a per-TIFF error handler #27927

libtiff 4.5 introduced [per-TIFF error handlers](https://libtiff.gitlab.io/libtiff/functions/TIFFOpenOptions.html). This PR removes the global OpenCV error handlers and uses per-handle error handlers. This reduces any risks associated with modifying global state, e.g. if another library also tries to set the global error handlers and OpenCV clobbers them.

### 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
2025-10-23 13:38:10 +03:00
Alexander Smorkalov 09c893477e Merge pull request #27443 from ritamelo06:gapi-feature
feat: G-API: Custom stream sources in Python (#27276)
2025-10-21 12:59:06 +03:00
Jay Pol 47d71530a7 Merge pull request #27866 from JayPol559:4.x
Fix HDR tutorial result mismatch by adding gamma note #27866

This PR fixes #22219 by clarifying the gamma correction value in the HDR tutorial.

The function cv.createTonemap() has a default gamma value of 1.0. To match the tutorial example results, gamma should be explicitly set to 2.2. This note has been added to the Tonemap HDR image section of the tutorial.
2025-10-21 12:30:58 +03:00
Alexander Smorkalov 543e9ed010 Merge pull request #27926 from MaximSmolskiy:add_comments_for_fisheye_undistortPoints
Add comments for fisheye::undistortPoints
2025-10-21 08:16:38 +03:00
MaximSmolskiy b65d66e797 Add comments for fisheye::undistortPoints 2025-10-21 04:56:22 +03:00
Alexander Smorkalov 50cd7b8b4b Merge pull request #27923 from cudawarped:move_throw_no_cuda_to_stub
[core][cuda] Move throw_no_cuda to it an independant stub
2025-10-20 19:54:28 +03:00
Alexander Smorkalov 53a96cdc0b Merge pull request #27922 from Kumataro:fix27921
imgcodecs: GDAL: show GDAL version at OpenCV configuration
2025-10-20 16:18:58 +03:00
Alexander Smorkalov fa276bba3d Merge pull request #27919 from Kumataro:fix27830
imgcodecs: Workaround for image flipping bug in older GDAL FITS drivers
2025-10-20 15:18:25 +03:00
cudawarped ff216e8796 [core][cuda] Move throw_no_cuda to it an independant stub so it is not included in the same file that requires cudart 2025-10-20 13:10:23 +03:00
Kumataro 346308124a imgcodecs: GDAL: show GDAL version at OpenCV configuration 2025-10-20 18:37:04 +09:00
Alexander Smorkalov 11422da957 Merge pull request #27920 from MaximSmolskiy:support_qr_decomposition_for_stereoCalibrate
Support QR decomposition for stereoCalibrate
2025-10-20 09:49:12 +03:00
Alexander Smorkalov 70d69d07c8 Merge pull request #27914 from MaximSmolskiy:refactor_minEnclosingCircle
Refactor minEnclosingCircle
2025-10-20 08:40:28 +03:00
MaximSmolskiy 455720aae8 Support QR decomposition for stereoCalibrate 2025-10-19 19:34:13 +03:00
Kumataro 75f738b3d1 imgcodecs: Workaround for image flipping bug in older GDAL FITS drivers 2025-10-19 15:38:00 +09:00
Alexander Smorkalov cb8f398a87 Merge pull request #27915 from MaximSmolskiy:fix_ml_kdtree_findNearest
Fix ml::KDTree::findNearest
2025-10-17 12:01:12 +03:00
Dmitry Kurtaev f1a99760ad Merge pull request #27841 from dkurt:ffmpeg_camera
Open camera device by index through FFmpeg #27841

### Pull Request Readiness Checklist

resolves https://github.com/opencv/opencv/issues/26812

Example of explicit backend option (similar to `-f v4l2` from command line)
```
export OPENCV_FFMPEG_CAPTURE_OPTIONS="f;v4l2"
```
see https://trac.ffmpeg.org/wiki/Capture/Webcam for available options

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
2025-10-17 10:23:24 +03:00
MaximSmolskiy 98a12515fe Fix ml::KDTree::findNearest 2025-10-16 22:58:55 +03:00
MaximSmolskiy e45d07e95b Refactor minEnclosingCircle 2025-10-16 22:18:39 +03:00
Alexander Smorkalov c75cd1047b Merge pull request #27911 from Kumataro:refix26899
core: fix lut_data data type
2025-10-16 15:55:40 +03:00
s-trinh f5014c179f Merge pull request #27736 from s-trinh:use_USAC_P3P_in_solvePnP
Update Gao P3P with Ding P3P #27736

### 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
- [ ] 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

---

The current Gao P3P implementation does not cover all the degenerate cases, **see last line** in: https://github.com/opencv/opencv/blob/6d889ee74c94124f6492eb8f0d50946d9c31d8e9/modules/calib3d/src/p3p.cpp#L211-L221

See also:
- https://github.com/opencv/opencv/issues/4854

---

<details>

<summary>OBSOLETE</summary>

To fix this, the USAC P3P from OpenCV 5 is used instead: https://github.com/opencv/opencv/blob/7e6da007cddcf83a527dfda95d57228fa5a535d3/modules/3d/src/usac/pnp_solver.cpp#L282

---

## Some results

### Old P3P vs new

In the following video, I have tried to highlight the viewpoints which cause issues:

https://github.com/user-attachments/assets/97bec6a6-4043-4509-b50e-a9856d6423bd

| | Old P3P    | New P3P |
| -------- | ------- | ------- |
| Mean (ms)  | 0.045701 | 0.024816 |
| Median (ms) | 0.025146 | 0.023193 |
| Std (ms)    | 0.028953    | 0.006124 |

### New P3P vs AP3P

https://github.com/user-attachments/assets/eaeb21dc-3ffd-4b6c-9902-4352f824aa45

The AP3 method is superior both in term of accuracy and computation time:

| | New P3P    | AP3P |
| -------- | ------- | ------- |
| Mean (ms)  | 0.043750 | 0.023442 |
| Median (ms) | 0.023193 | 0.021484 |
| Std (ms)    | 0.039920 | 0.005265 |

### New P3P vs AP3P (range test)

https://github.com/user-attachments/assets/572e7b7a-2966-4bed-8e0c-b93d863987dc

The implemented P3P method does not work well when the tag is small, at long range.

| | New P3P    | AP3P |
| -------- | ------- | ------- |
| Mean (ms)  | 0.031351 | 0.025189 |
| Median (ms) | 0.022217 | 0.020996 |
| Std (ms)    | 0.024920 | 0.009633 |

---

- I have tried to simplify the P3P code, hope I did not break the implementation code
- calculations are performed using double type for simplicity.
- code such as the following are redundant and no more needed and should be replaced by `cv::Rodrigues`:

https://github.com/opencv/opencv/blob/6d889ee74c94124f6492eb8f0d50946d9c31d8e9/modules/calib3d/src/usac/pnp_solver.cpp#L395

</details>
2025-10-16 15:21:15 +03:00
Kumataro ec630504a7 core: fix lut_data data type 2025-10-16 21:19:12 +09:00
Alexander Smorkalov 6c009c2a14 Merge pull request #27903 from victorget:dev/ipp_hal_threading
Fixed parallel invoke for warp perspective for best performance
2025-10-16 14:55:15 +03:00
Alexander Smorkalov 703f0bb0f2 Merge pull request #27906 from asmorkalov:as/cairosvg
Use cairosvg for pattern rendering to get rid of double resize. #27906

Depends on https://github.com/opencv/ci-gha-workflow/pull/269

### 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
2025-10-16 12:06:35 +03:00
Kumataro d0d9bd20ed Merge pull request #27890 from Kumataro:fix26899
core: support 16 bit LUT #27890

Close https://github.com/opencv/opencv/issues/26899

### 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
2025-10-16 12:03:02 +03:00
Alexander Smorkalov c88b3cb11f Merge pull request #27910 from MaximSmolskiy:add_corner_cases_tests_for_minEnclosingCircle
Add corner cases tests for minEnclosingCircle
2025-10-16 10:36:42 +03:00