-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
5.x merge 4.x #27435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
5.x merge 4.x #27435
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updating doc markdown to include newly added FastCV HAL and Extension…
Fix opencv#25696: Solved the problem in Subdiv2D, empty delaunay triangulation opencv#27149 Detailed description Expected behaviour: Given 4 points, where no three points are collinear, the Delaunay Triangulation Algorithm should return 2 triangles. Actual: The algorithm returns zero triangles in this particular case. Fix: The radius of the circumcircle tends to infinity when the points are closer to form collinear points, so the problem occurs because the super-triangles are not large enough, which then results in certain edges are not swapped. The proposed solution just increases the super triangle, duplicating the value of constant for example. ### 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
Updating doc markdown to include API in FastCV gemm HAL
…ithAccumulator_binding Update HoughLinesWithAccumulator binding
…thAccumulator_binding Add HoughCirclesWithAccumulator binding opencv#27389 ### Pull Request Readiness Checklist Fix opencv#27377 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
imgcodecs: jpegxl: support lossless compression opencv#27384 Close opencv#27382 ### 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
Fixed bug in ifdef state machine in header parser for bindings
…ints_2 Add getClosestEllipsePoints() function to get the closest point on an ellipse opencv#26299 Following opencv#26078, I was thinking that a function to get for a considered 2d point the corresponding closest point (or maybe directly the distance?) on an ellipse could be useful. This would allow computing the fitting error with `fitEllipse()` for instance. Code is based from: - https://stackoverflow.com/questions/22959698/distance-from-given-point-to-given-ellipse/46007540#46007540 - https://blog.chatfield.io/simple-method-for-distance-to-ellipse/ - https://github.com/0xfaded/ellipse_demo --- Demo code: <details> <summary>code</summary> ```cpp #include <iostream> #include <opencv2/opencv.hpp> namespace { void scaleApplyColormap(const cv::Mat &img_float, cv::Mat &img) { cv::Mat img_scale = cv::Mat::zeros(img_float.size(), CV_8UC3); double min_val = 0, max_val = 0; cv::minMaxLoc(img_float, &min_val, &max_val); std::cout << "min_val=" << min_val << " ; max_val=" << max_val << std::endl; if (max_val - min_val > 1e-2) { float a = 255 / (max_val - min_val); float b = -a * min_val; cv::convertScaleAbs(img_float, img_scale, a, b); cv::applyColorMap(img_scale, img, cv::COLORMAP_TURBO); } else { std::cerr << "max_val - min_val <= 1e-2" << std::endl; } } cv::Mat drawEllipseDistanceMap(const cv::RotatedRect &ellipse_params) { float bb_rect_w = ellipse_params.center.x + ellipse_params.size.width; float bb_rect_h = ellipse_params.center.y + ellipse_params.size.height; std::vector<cv::Point2f> points_list; points_list.resize(1); cv::Mat pointsf; cv::Mat closest_pts; cv::Mat dist_map = cv::Mat::zeros(bb_rect_h*1.5, bb_rect_w*1.5, CV_32F); for (int i = 0; i < dist_map.rows; i++) { for (int j = 0; j < dist_map.cols; j++) { points_list[0].x = j; points_list[0].y = i; cv::Mat(points_list).convertTo(pointsf, CV_32F); cv::getClosestEllipsePoints(ellipse_params, pointsf, closest_pts); dist_map.at<float>(i, j) = std::hypot(closest_pts.at<cv::Point2f>(0).x-j, closest_pts.at<cv::Point2f>(0).y-i); } } cv::Mat dist_map_8u; scaleApplyColormap(dist_map, dist_map_8u); return dist_map_8u; } } int main() { std::vector<cv::Point2f> points_list; // [1434, 308], [1434, 309], [1433, 310], [1427, 310], [1427, 312], [1426, 313], [1422, 313], [1422, 314], points_list.push_back(cv::Point2f(1434, 308)); points_list.push_back(cv::Point2f(1434, 309)); points_list.push_back(cv::Point2f(1433, 310)); points_list.push_back(cv::Point2f(1427, 310)); points_list.push_back(cv::Point2f(1427, 312)); points_list.push_back(cv::Point2f(1426, 313)); points_list.push_back(cv::Point2f(1422, 313)); points_list.push_back(cv::Point2f(1422, 314)); // [1421, 315], [1415, 315], [1415, 316], [1414, 317], [1408, 317], [1408, 319], [1407, 320], [1403, 320], points_list.push_back(cv::Point2f(1421, 315)); points_list.push_back(cv::Point2f(1415, 315)); points_list.push_back(cv::Point2f(1415, 316)); points_list.push_back(cv::Point2f(1414, 317)); points_list.push_back(cv::Point2f(1408, 317)); points_list.push_back(cv::Point2f(1408, 319)); points_list.push_back(cv::Point2f(1407, 320)); points_list.push_back(cv::Point2f(1403, 320)); // [1403, 321], [1402, 322], [1396, 322], [1396, 323], [1395, 324], [1389, 324], [1389, 326], [1388, 327], points_list.push_back(cv::Point2f(1403, 321)); points_list.push_back(cv::Point2f(1402, 322)); points_list.push_back(cv::Point2f(1396, 322)); points_list.push_back(cv::Point2f(1396, 323)); points_list.push_back(cv::Point2f(1395, 324)); points_list.push_back(cv::Point2f(1389, 324)); points_list.push_back(cv::Point2f(1389, 326)); points_list.push_back(cv::Point2f(1388, 327)); // [1382, 327], [1382, 328], [1381, 329], [1376, 329], [1376, 330], [1375, 331], [1369, 331], [1369, 333], points_list.push_back(cv::Point2f(1382, 327)); points_list.push_back(cv::Point2f(1382, 328)); points_list.push_back(cv::Point2f(1381, 329)); points_list.push_back(cv::Point2f(1376, 329)); points_list.push_back(cv::Point2f(1376, 330)); points_list.push_back(cv::Point2f(1375, 331)); points_list.push_back(cv::Point2f(1369, 331)); points_list.push_back(cv::Point2f(1369, 333)); // [1368, 334], [1362, 334], [1362, 335], [1361, 336], [1359, 336], [1359, 1016], [1365, 1016], [1366, 1017], points_list.push_back(cv::Point2f(1368, 334)); points_list.push_back(cv::Point2f(1362, 334)); points_list.push_back(cv::Point2f(1362, 335)); points_list.push_back(cv::Point2f(1361, 336)); points_list.push_back(cv::Point2f(1359, 336)); points_list.push_back(cv::Point2f(1359, 1016)); points_list.push_back(cv::Point2f(1365, 1016)); points_list.push_back(cv::Point2f(1366, 1017)); // [1366, 1019], [1430, 1019], [1430, 1017], [1431, 1016], [1440, 1016], [1440, 308] points_list.push_back(cv::Point2f(1366, 1019)); points_list.push_back(cv::Point2f(1430, 1019)); points_list.push_back(cv::Point2f(1430, 1017)); points_list.push_back(cv::Point2f(1431, 1016)); points_list.push_back(cv::Point2f(1440, 1016)); points_list.push_back(cv::Point2f(1440, 308)); cv::Mat pointsf; cv::Mat(points_list).convertTo(pointsf, CV_32F); cv::RotatedRect ellipse_params = cv::fitEllipseAMS(pointsf); std::cout << "ellipse_params, center=" << ellipse_params.center << " ; size=" << ellipse_params.size << " ; angle=" << ellipse_params.angle << std::endl; cv::TickMeter tm; tm.start(); cv::Mat dist_map_8u = drawEllipseDistanceMap(ellipse_params); tm.stop(); std::cout << "Elapsed time: " << tm.getAvgTimeSec() << " sec" << std::endl; cv::Point center(ellipse_params.center.x, ellipse_params.center.y); cv::Point axis(ellipse_params.size.width/2, ellipse_params.size.height/2); std::vector<cv::Point> ellipse_pts_list; cv::ellipse2Poly(center, axis, ellipse_params.angle, 0, 360, 1, ellipse_pts_list); cv::polylines(dist_map_8u, ellipse_pts_list, false, cv::Scalar(0, 0, 0), 3); // Points to be fitted cv::Mat closest_pts; cv::getClosestEllipsePoints(ellipse_params, pointsf, closest_pts); for (int i = 0; i < closest_pts.rows; i++) { cv::Point pt; pt.x = closest_pts.at<cv::Point2f>(i).x; pt.y = closest_pts.at<cv::Point2f>(i).y; cv::circle(dist_map_8u, pt, 8, cv::Scalar(0, 0, 255), 2); } cv::imwrite("dist_map_8u.png", dist_map_8u); return EXIT_SUCCESS; } ``` </details>  --- ### 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
Relax remap relative test to handle the case when HAL implements not all remap options
Check MS Media Foundation availability in G-API too opencv#27355 Tries to address opencv/opencv-python#771 ### 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
Fix NaNs in HDR Triangle Weights and Tonemapping and Update LDR Ground Truth in tutorial opencv#27396 The PR closes opencv#27392 Updated the triangle weights to use a small epsilon value instead of zero to prevent NaN issues in HDR processing. Also fixed a float-to-double division issue by explicitly casting double values to float, which was previously producing garbage values and leading to NaNs in tonemapping. The current LDR ground truth image used in the tutorial [ldr.png](https://github.com/opencv/opencv/blob/4.x/doc/tutorials/others/images/ldr.png) was originally generated using TonemapDurand (check this commit opencv@833f8d1), which was moved to opencv_contrib a long time ago in this commit: opencv@742f22c. However, the current Tonemap implementation in OpenCV main only performs normalization and gamma correction, which produces noticeably different results. This PR updates the LDR grouth truth image in tutorial with the result of TonemapDrago, and tutorials to use TonemapDrago as Tonemap gives a darker image. Tonemap output:  TonemapDrago output:  ### 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
Fix empty ND-array construction
Use older version of IPP for Android x86 32bit to resolve linkage issues
FastCV latest libs hash update opencv#27403 Update hash for the fastcv libs for Linux Updated libs PR: opencv/opencv_3rdparty#97 ### 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
Fix valgrind warnings in tests opencv#27418 ### Pull Request Readiness Checklist https://pullrequest.opencv.org/buildbot/builders/4_x_valgrind-lin64-debug/builds/100131/steps/test_calib3d/logs/valgrind%20summary https://pullrequest.opencv.org/buildbot/builders/4_x_valgrind-lin64-debug/builds/100131/steps/test_imgproc/logs/valgrind%20summary 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
…olorless-images-26276 fix opencv#26276: cv::VideoWriter fails writing colorless images opencv#27153 When writing grayscale images (`isColor=false`), `cv::VideoWriter` failed as FFmpeg backend requires input frames to be in a grayscale format. Unlike other backends, FFmpeg doesn't perform this conversion internally and expects the input to be pre-converted. To fix this, I inserted a check in the `CvVideoWriter_FFMPEG_proxy::write` to convert input frames to grayscale when the input has more than 1 channel. If this is true, then the input is converted to a gray image using `cv::cvtColor` (with `cv::COLOR_BGR2GRAY`). Additionally, as suggested in the issue comments, I have correctly propagated the return value of `CvVideoWriter_FFMPEG::writeFrame` back to the `CvVideoWriter_FFMPEG_proxy::write`. This return value wasn't being used, and `writeFrame` was always returning false since the FFmeg's return code `AVERROR(EAGAIN)` was mistakenly being treated as an error. Now it's handled as a signal for additional input (current input was successfully written, and a new frame should be sent. [See FFmpeg documentation for `avcodec_receive_packet`](https://ffmpeg.org/doxygen/6.1/group__lavc__decoding.html)). A warning is displayed if `CvVideoWriter_FFMPEG::writeFrame` returns false. Alternatively, this could be propagated back up to the user, making cv::VideoWriter::write a boolean. Finally, I added a test case to verify if the grayscale conversion is being done correctly. Fixes opencv#26276 ### 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
Fix RISC-V HAL Imgproc_WarpPerspective.accuracy
…ctor Deprecate copyData Parameter in UMat Construction from std::vector and Always Copy Data opencv#27408 Overview This PR simplifies and modernizes the construction of cv::UMat from std::vector by removing the legacy copyData parameter, always copying the data, and ensuring clearer, safer semantics. This brings UMat in line with current best practices and paves the way for the upcoming OpenCV 5.x series. What Changed? 1. Header Documentation Update Removed confusing or obsolete documentation about copyData and clarified the behavior: Old: builds matrix from std::vector with or without copying the data New: builds matrix from std::vector. The data is always copied. The copyData parameter is deprecated and will be removed in OpenCV 5.0. 2. Implementation Update In UMat::UMat(const std::vector<_Tp>& vec, bool copyData), the copyData parameter: Is now ignored and marked as deprecated. Marked with CV_UNUSED(copyData) for backward compatibility and to avoid warnings. The constructor always copies the data from the input vector, regardless of the value of copyData. All branching logic around copyData has been removed. Any code for "not copying" was not implemented and is now dropped. This guarantees data safety and predictable behavior. 3. Test Added A new test construct_from_vector in test_umat_from_vector.cpp: Verifies that UMat copies the vector data, not referencing it. Modifies the source vector after construction to confirm that the UMat is unaffected (proving copy, not reference). Checks matrix shape, type, and content to ensure correctness. Why This Change? 1. Safety and Predictability Always copying avoids dangling references and hard-to-debug lifetime issues with stack/heap-allocated vectors. Removes an undocumented, unimplemented branch (copyData=false). 2. Backward Compatibility The constructor signature remains for now, but the copyData parameter is marked as deprecated and ignored. Codebases that pass the parameter will still compile and run as before (but always copy). 3. API Clarity and Maintenance Documentation now matches the real implementation. No misleading expectations about zero-copy. Code is cleaner, future-proof, and easier to maintain. 4. Preparation for OpenCV 5.0 The copyData parameter is deprecated and will be removed in OpenCV 5.x. Prepares users and downstream libraries for the planned change. How This Helps OpenCV Users and Developers Guarantees data safety and makes behavior explicit. Removes legacy/ambiguous code. Provides a clear path to OpenCV 5.x. Minimizes future migration pain. Ensures all users see the same, reliable behavior (copy semantics). Refer:opencv#27409
…-major-repo-issue Fix incorrect Y-coordinate sampling in drawing primitives (circle, text, ellipse)
Cover all seek directions in VideoCapture Java test opencv#27421 ### Pull Request Readiness Checklist required for opencv#27370 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
Fixed Android setCameraIndex issue. opencv#27419 Fixed camera switching issue on Android devices: When a device has more than two cameras, the setCameraIndex method failed to switch to non-default cameras. Root cause: The original code only considered two default camera IDs when updating camera IDs, ignoring all others. This fix ensures all camera IDs are properly handled. ### 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
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
…generate Cmake protobuf_generate_cpp deprecated use protobuf_generate
Document Qualcomm's FastCV DSP based OpenCV Extension APIs and usage instructions opencv#27430 This PR updates the documentation by: - Adding a new section: Qualcomm's FastCV DSP based OpenCV Extension APIs list, detailing the OpenCV APIs under the cv::fastcv::dsp namespace and their corresponding Qualcomm's FastCV DSP accelerated implementations. - Providing a step-by-step guide on how to use the Qualcomm's FastCV DSP APIs. - Update resizeDown and warpAffine mappings ### 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
dkurt
approved these changes
Jun 11, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
OpenCV Contrib: opencv/opencv_contrib#3951
#26299 from s-trinh:feat/getClosestEllipsePoints_2
#27149 from liane-lin:4.x
#27153 from 03kiko:fix-videowriter-writing-colorless-images-26276
#27362 from vrabaud:tsan
#27375 from CodeLinaro:doc_update
#27384 from Kumataro:fix27382
#27385 from CodeLinaro:doc_update
#27389 from MaximSmolskiy:add_HoughCirclesWithAccumulator_binding
#27390 from MaximSmolskiy:update_HoughLinesWithAccumulator_binding
#27393 from asmorkalov:as/elseif_hdr_parser
#27396 from abhishek-gola:hdr_bug_fix
#27398 from asmorkalov:as/relax_remap_relative
#27403 from CodeLinaro:apreetam_6thPost
#27406 from asmorkalov:as/revert_android_ipp
#27408 from KAVYANSHTYAGI:Umat-vector-contructor
#27414 from amane-ame:remap_fix
#27418 from dkurt:fix_valgrind_warnings
#27419 from FleeOvernight:fixUpdCameraId
#27422 from KAVYANSHTYAGI:codex/find-and-fix-major-repo-issue
#27428 from phanirithvij:dnn-cmake-protobuf-generate
#27430 from CodeLinaro:dsp_markdown
Previous "Merge 4.x": #27370