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

595 Commits

Author SHA1 Message Date
Vincent Rabaud 721f70feff Port CvLevMarq to C++ 2026-04-28 12:30:06 +02:00
Alexander Smorkalov 5258bc5de9 Merge pull request #28317 from raimbekovm:fix-typos-batch7
docs: fix typos in documentation and code comments
2026-01-23 11:29:02 +03:00
Vincent Rabaud 5622958189 Replace pow with std::pow
The C pow casts to double while std::pow has overloads that can be
optimized by the compiler.
Also replace pow(*, 1./3) by cbrt.
2026-01-04 15:12:59 +01:00
raimbekovm c058072d62 docs: fix typos in documentation and code comments
Fixed 19 typos across 15 files:
- properies → properties
- posible → possible (2×)
- indeces → indices
- matrixs → matrices (2×)
- grater → greater
- whith → with
- ouput → output
- choosen → chosen (4×)
- constains → contains
- refrence → reference
- dont → don't (4×)
- cant → can't
2025-12-26 23:42:51 +06:00
AdwaithBatchu 5f0bd387db optimize: replace push_back with emplace_back in core loops
Replaces wasteful temporary object construction with in-place construction using emplace_back. Covers hot paths in objdetect, imgproc, and stitching modules.
2025-12-19 11:56:20 +05:30
sinkboy-chen 4c7fd071f0 Merge pull request #28118 from sinkboy-chen:bugfix/cuda-race-condition
stitching: pass warp params by value to avoid CUDA constant races #28118

### 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 the Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on 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 are accuracy tests, performance tests, and test data in the opencv_extra repository, if applicable.  
      The patch to opencv_extra uses the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake configuration.

Fixes #26870.

In `modules/stitching/src/cuda/build_warp_maps.cu`, the original implementation copied parameters into global GPU constant symbols:

```cpp
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::ck_rinv, k_rinv, 9 * sizeof(float)));
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::cr_kinv, r_kinv, 9 * sizeof(float)));
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::cscale, &scale, sizeof(float)));
```

As discussed in the issue, this can cause race conditions when multiple warps are built concurrently. This patch removes the use of these global constant symbols and instead passes the required data as kernel parameters (a total of 11 floats encapsulated in `WarpParams`).

One potential concern is increased register pressure due to additional kernel arguments. However, based on experiments using the test case from issue #26870, there is no significant performance regression; in fact, a small speed‑up was observed.

Testing was performed on an NVIDIA GeForce RTX 4090 (single GPU).

Note: ./bin/opencv_perf_stitching did not run successfully on my system even with an unmodified git checkout, so performance was evaluated using the test case from issue #26870 instead.
2025-12-03 08:51:59 +03:00
Ghazi-raad 71c759b7cd Merge pull request #28085 from Ghazi-raad:fix/multiband-blender-memory-leak-27333
Fixed multiband blender memory leak 27333 #28085

Fixes #27333

This PR fixes a memory leak in MultiBandBlender where memory from pyramid vectors was not being released when prepare() was called multiple times or when the blender object was reused.

Problem:

MultiBandBlender retains hundreds of MB to several GB of memory even after the blender pointer is released. The issue occurs because:

1. The resize() function on std::vector does not release memory when the new size is less than or equal to the current size
2. It only adjusts the size marker while retaining the capacity and existing data
3. When prepare() is called, the pyramid vectors are resized but old data remains allocated

Example from the bug report: Blending 14 images (1920x1080) retained ~200MB after blender.release(). With larger images, several GB could be retained.

Root Cause:

GPU path (lines 254-256): Correctly calls clear() before operations
Non-GPU path (lines 285-298): Missing clear() calls, causing resize() to retain old data

Solution:

Added .clear() calls before .resize() in the non-GPU path to match the GPU path behavior. This ensures:
- Memory from previous blend operations is released in prepare()
- Reusing a blender object doesn't accumulate memory
- Behavior is consistent between GPU and non-GPU code paths

Changes:

modules/stitching/src/blenders.cpp: Added 2 clear() calls (dst_pyr_laplace_.clear() and dst_band_weights_.clear()) before resize() in the non-GPU path

Pull Request Readiness Checklist:

- [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 reference to the original bug report and related work (issue #27333)
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      N/A - This is a memory management fix that doesn't affect algorithm behavior. Existing stitching tests verify correctness.
- [x] The feature is well documented and sample code can be built with the project CMake
      The fix maintains existing API behavior, no documentation changes needed
2025-11-27 09:57:21 +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
Alexander Smorkalov b28d9bef1d Renamed templated BlocksCompensator::feed method to exclude claches with base class pure virtual method. 2025-09-08 14:52:58 +03:00
s-trinh df5da4abcd Merge pull request #26754 from s-trinh:add_bibtex_direct_pdf_links
Add direct pdf links in the bibliography #26754

Update and add pdf links in the bibliography.

### 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-01-27 10:28:38 +03:00
Alexander Smorkalov 905cc45f85 Document some stitching methods and enable bindings for them. 2024-11-25 14:03:49 +03:00
Kumataro a3bdbf5553 Merge pull request #26022 from Kumataro:fix26016
Imgproc: use double to determine whether the corners points are within src #26022

close #26016
Related https://github.com/opencv/opencv_contrib/pull/3778

### 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
2024-08-23 12:35:13 +03:00
Alexander Smorkalov daa8f7dfc6 Partially back-port #25075 to 4.x 2024-03-05 12:15:39 +03:00
Sean McBride e64857c561 Merge pull request #23736 from seanm:c++11-simplifications
Removed all pre-C++11 code, workarounds, and branches #23736

This removes a bunch of pre-C++11 workrarounds that are no longer necessary as C++11 is now required.
It is a nice clean up and simplification.

* No longer unconditionally #include <array> in cvdef.h, include explicitly where needed
* Removed deprecated CV_NODISCARD, already unused in the codebase
* Removed some pre-C++11 workarounds, and simplified some backwards compat defines
* Removed CV_CXX_STD_ARRAY
* Removed CV_CXX_MOVE_SEMANTICS and CV_CXX_MOVE
* Removed all tests of CV_CXX11, now assume it's always true. This allowed removing a lot of dead code.
* Updated some documentation consequently.
* Removed all tests of CV_CXX11, now assume it's always true
* Fixed links.

---------

Co-authored-by: Maksim Shabunin <maksim.shabunin@gmail.com>
Co-authored-by: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
2024-01-19 16:53:08 +03:00
Kumataro 1911c63826 fix: supress GCC13 warnings (#24434)
* fix: supress GCC13 warnings

* fix for review and compile-warning on MacOS
2023-10-26 09:00:58 +03:00
Sean McBride 5fb3869775 Merge pull request #23109 from seanm:misc-warnings
* Fixed clang -Wnewline-eof warnings
* Fixed all trivial clang -Wextra-semi and -Wc++98-compat-extra-semi warnings
* Removed trailing semi from various macros
* Fixed various -Wunused-macros warnings
* Fixed some trivial -Wdocumentation warnings
* Fixed some -Wdocumentation-deprecated-sync warnings
* Fixed incorrect indentation
* Suppressed some clang warnings in 3rd party code
* Fixed QRCodeEncoder::Params documentation.

---------

Co-authored-by: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
2023-10-06 13:33:21 +03:00
Alexander Smorkalov 0c8e6e0e68 Merge pull request #23740 from Peekabooc:4.x
fixing typo in stitching parameter names
2023-06-09 13:40:02 +03:00
Alexander Smorkalov af03e000c7 Merge pull request #23732 from vekkuli:vekkuli-patch-create-featherblender
Fix missuse of try_gpu in stitching/FeatherBlender
2023-06-06 10:00:36 +03:00
Wang Kai 983925c685 fixing typo 2023-06-04 19:06:26 +08:00
Jaakko Rantala 385003e9fe Update blenders.cpp
Removed passing try_gpu parameter to FeatherBlender constructor because it only has sharpness parameter.
2023-06-02 16:46:05 +03:00
Alexander Smorkalov e4a29d93fe Merge remote-tracking branch 'origin/3.4' into merge-3.4 2023-04-21 10:55:04 +03:00
Lilit Grigoryan a87b9fb4b6 Fix focal length estimation from homography matrix 2023-02-14 21:51:09 +03:00
Alexander Smorkalov 5cd07006f6 Merge pull request #22329 from chinery:stitching-py-fixes
Fix stitching Python bindings (and one stitching_detailed.cpp bug)
2022-10-07 15:03:37 +03:00
Alexander Smorkalov 784dd55d88 Extracted matches_confindece_thresh as stitching matcher parameter. 2022-09-29 09:04:24 +03:00
Alexander Smorkalov bfeeb0ad70 Merge pull request #22285 from asenyaev:asen/disabled_compiling_warnings_3.4
Disabled compiling warnings in case of symbols in cmake for 3.4
2022-09-20 15:14:36 +03:00
Andrey Senyaev ccfc34b13f Disabled compiling warnings in case of symbols in cmake for 4.x 2022-09-20 13:35:48 +03:00
Andrey Senyaev 3f4abcb228 Disabled compiling warnings in case of symbols in cmake for 3.4 2022-09-20 13:34:17 +03:00
Andrew Chinery 26a7647e0e Fix stitching Python bindings PR #22329 2022-09-13 14:35:42 +01:00
Alexander Alekhin 44b2f9637a Revert "suppress warning on GCC 7 and later"
This reverts commit a630ad73cb.
2022-08-07 15:43:10 +03:00
Tomoaki Teshima a630ad73cb suppress warning on GCC 7 and later 2022-07-06 23:31:31 +09:00
Dan 32bb4fa950 Update doc 2022-07-01 13:33:05 +02:00
Namgoo Lee 24547f40ff remove const from functions returning by value 2022-05-26 21:30:41 +09:00
Kumataro 602caa9cd6 Merge pull request #21937 from Kumataro:4.x-fix-21911
* Fix warnings for clang15

* Fix warnings: Remove unnecessary code

* Fix warnings: Remove unnecessary code
2022-05-13 17:32:05 +00:00
Oguzhan Guclu 38788a3161 Merge pull request #21803 from oguzhanguclu:matches_info_pybinding
python binding for matches and inliers_mask attributes of cv2.detail_MatchesInfo class

* making matches and inliers_mask attributes of cv2.detail_MatchesInfo class accessible from python interface

* binding test for cv2.detail_MatchesInfo class
2022-04-01 22:13:14 +00:00
Alexander Alekhin 5a86592e93 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2022-02-19 21:04:35 +00:00
KaurkerDevourer 9198e30688 Fix DpSeamFinder::hasOnlyOneNeighbor
std::lower_bound is linear for set
https://en.cppreference.com/w/cpp/algorithm/lower_bound
2022-02-19 14:24:05 +03:00
Tejas M R 676a724491 Merge pull request #21180 from tezz-io:4.x
Added CV_PROP_RW macro to keypoints

* Added CV_PROP_RW macro to keypoints

As outlined in the feature request in the issue https://github.com/opencv/opencv/issues/21171 : the keypoints field has been made parsable by the bindings.

* Added test for keypoints

Added test to check if the CV_PROP_RW macro added in the previous commit makes keypoints public and accessible through the python API.
2021-12-05 12:47:44 +00:00
Alexander Alekhin 170bf6d7af Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-05-01 09:44:24 +00:00
danielenricocahall 3930c9a492 fix loop boundary condition 2021-04-20 22:08:01 -04:00
Amir Tulegenov 04d907fb97 Merge pull request #19619 from amirtu:OCV-221_get_and_set_cameras_on_stitcher
* Get and set cameras for sticher.

* Code review fixes.

Co-authored-by: amir.tulegenov <amir.tulegenov@xperience.ai>
Co-authored-by: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
2021-03-09 17:51:40 +00:00
Alexander Alekhin e5d78960c6 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-02-12 21:34:49 +00:00
Alexander Smorkalov 3b9aebee11 Not not test stitiching with SURF, if NONFREE is disabled 2021-02-09 16:54:06 +03:00
Alexander Alekhin 6b474c4051 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-02-06 00:44:11 +00:00
Alexander Smorkalov 0016c25b58 Guard non-free usage in stitching as contrib can be built without it. 2021-02-02 13:24:59 +03:00
Tomoaki Teshima e49ae68524 workaround the test failure 2021-01-18 06:03:43 +09:00
chargerKong 11cfa64a10 Merge pull request #18335 from chargerKong:master
Ordinary quaternion

* version 1.0

* add assumeUnit;
add UnitTest;
check boundary value;
fix the func using method: func(obj);
fix 4x4;
add rodrigues vector transformation;
fix mat to quat;

* fix blank and tab

* fix blank and tab
modify test;cpp to hpp

* mainly improve comment;
add rvec2Quat;fix toRodrigues;
fix throw to CV_Error

* fix bug of quatd * int;
combine hpp and cpp;
fix << overload error in win system;
modify include in test file;

* move implementation to quaternion.ini.hpp;
change some constructor to createFrom* function;
change Rodrigues vector to rotation vector;
change the matexpr to mat of 3x3 return type;
improve comments;

* try fix log function error in win

* add enums for assumeUnit;
improve docs;
add using std::cos funcs

* remove using std::* from header;
add std::* in affine.hpp,warpers_inl.hpp;

* quat: coding style

* quat: AssumeType => QuatAssumeType
2020-11-19 16:59:33 +00:00
Alexander Alekhin f345ed564a Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-10-26 20:07:47 +00:00
Quentin Chateau 36598677cf Merge pull request #18646 from qchateau:wave-auto
* stitching: add WAVE_CORRECT_AUTO

* stitching: use CV_EXPORTS
2020-10-25 15:58:27 +00:00
Quentin Chateau ea1e3fb90d Merge pull request #18624 from qchateau:similarity-mask
* support similarity masks

* add test for similarity threshold

* short license in test

* use UMat in buildSimilarityMask

* fix win32 warnings

* fix test indentation

* fix umat/mat sync

* no in-place argument for erode/dilate
2020-10-22 12:24:58 +00:00
Rob Timpe 22ee5c0c4d Fix errors when building with cuda stubs
Fixes two errors when building with the options WITH_CUDA=ON and BUILD_CUDA_STUBS=ON on a machine without CUDA.

In the cudaarithm module, make sure cuda_runtime.h only gets included when CUDA is installed.

In the stitching module, don't assume that cuda is present just because cudaarithm and cudawarping are present (as is the case when building with the above options).
2020-10-21 15:51:46 -07:00