Commit Graph

35300 Commits

Author SHA1 Message Date
Alexander Smorkalov
85b45656fa
Merge pull request #27428 from phanirithvij:dnn-cmake-protobuf-generate
Cmake protobuf_generate_cpp deprecated use protobuf_generate
2025-06-10 16:23:13 +03:00
phanirithvij
bbe2f50b5d Cmake protobuf_generate_cpp deprecated use protobuf_generate
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
2025-06-10 18:03:32 +05:30
FleeOvernight
6b4f5b48b1
Merge pull request #27419 from FleeOvernight:fixUpdCameraId
Fixed Android setCameraIndex issue. #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
2025-06-10 15:02:39 +03:00
Dmitry Kurtaev
809090f203
Merge pull request #27421 from dkurt:dkurt-patch-1
Cover all seek directions in VideoCapture Java test #27421

### Pull Request Readiness Checklist

required for https://github.com/opencv/opencv/pull/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
2025-06-10 14:51:32 +03:00
Alexander Smorkalov
4b69cc53e6
Merge pull request #27422 from KAVYANSHTYAGI:codex/find-and-fix-major-repo-issue
Fix incorrect Y-coordinate sampling in drawing primitives (circle, text, ellipse)
2025-06-10 10:59:12 +03:00
Kavyansh Tyagi
b13704b583 Fix coordinate generation in drawing sample 2025-06-09 23:43:34 +05:30
Kavyansh Tyagi
7ca36d9c50
Merge pull request #27408 from KAVYANSHTYAGI:Umat-vector-contructor
Deprecate copyData Parameter in UMat Construction from std::vector and Always Copy Data #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:#27409
2025-06-09 16:02:38 +03:00
Alexander Smorkalov
ebfee90c30
Merge pull request #27414 from amane-ame:remap_fix
Fix RISC-V HAL Imgproc_WarpPerspective.accuracy
2025-06-09 10:35:30 +03:00
Francisco Mónica
62b36495cc
Merge pull request #27153 from 03kiko:fix-videowriter-writing-colorless-images-26276
fix #26276: cv::VideoWriter fails writing colorless images #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 #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
2025-06-09 10:05:02 +03:00
Dmitry Kurtaev
d6864cdd22
Merge pull request #27418 from dkurt:fix_valgrind_warnings
Fix valgrind warnings in tests #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
2025-06-09 09:23:04 +03:00
amane-ame
b9cab7e4af Fix remap16s to pass Imgproc_WarpPerspective. 2025-06-08 15:09:37 +08:00
Aakash Preetam
d97e926f70
Merge pull request #27403 from CodeLinaro:apreetam_6thPost
FastCV latest libs hash update #27403

Update hash for the fastcv libs for Linux

Updated libs PR: https://github.com/opencv/opencv_3rdparty/pull/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
2025-06-06 12:27:13 +03:00
Alexander Smorkalov
a503070e01
Merge pull request #27406 from asmorkalov:as/revert_android_ipp
Use older version of IPP for Android x86 32bit to resolve linkage issues
2025-06-06 10:54:13 +03:00
Alexander Smorkalov
beeda17483
Merge pull request #27362 from vrabaud:tsan
Fix empty ND-array construction
2025-06-06 09:17:07 +03:00
Alexander Smorkalov
987548d041 Use older version of IPP for Android x86 32bit to resolve linkage issues. 2025-06-05 13:11:05 +03:00
Abhishek Gola
aef6ae4872
Merge pull request #27396 from abhishek-gola:hdr_bug_fix
Fix NaNs in HDR Triangle Weights and Tonemapping and Update LDR Ground Truth in tutorial #27396

The PR closes #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 833f8d16fa), which was moved to opencv_contrib a long time ago in this commit: 742f22c09b. 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:
![ldr2](https://github.com/user-attachments/assets/e4f0cb97-ee4f-47b9-8962-2020ff211fd5)

TonemapDrago output:
![ldr](https://github.com/user-attachments/assets/4a898101-22bd-49e5-8db0-9e1062974ba3)


### 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-06-05 09:02:58 +03:00
Alexander Smorkalov
9e18169959
Merge pull request #27355 from asmorkalov:as/gapi_control_msmf
Check MS Media Foundation availability in G-API too #27355

Tries to address https://github.com/opencv/opencv-python/issues/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
2025-06-04 16:30:50 +03:00
Alexander Smorkalov
a2c381a82b
Merge pull request #27398 from asmorkalov:as/relax_remap_relative
Relax remap relative test to handle the case when HAL implements not all remap options
2025-06-04 16:29:21 +03:00
s-trinh
e258f2595e
Merge pull request #26299 from s-trinh:feat/getClosestEllipsePoints_2
Add getClosestEllipsePoints() function to get the closest point on an ellipse #26299

Following https://github.com/opencv/opencv/issues/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>

![image](https://github.com/user-attachments/assets/3345cc86-ba83-44f9-ac78-74058a33a7dc)

---

### 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-06-03 17:12:16 +03:00
Alexander Smorkalov
0ccbd21c0a Relax remap relative test to handle the case when HAL implements not remap options. 2025-06-03 11:24:07 +03:00
Alexander Smorkalov
17d94277f0
Merge pull request #27393 from asmorkalov:as/elseif_hdr_parser
Fixed bug in ifdef state machine in header parser for bindings
2025-06-03 10:23:26 +03:00
Alexander Smorkalov
5205e26663 Fixed bug in ifdef state machine in header parser for bindings. 2025-06-02 12:41:39 +03:00
Kumataro
cd0699a338
Merge pull request #27384 from Kumataro:fix27382
imgcodecs: jpegxl: support lossless compression #27384

Close https://github.com/opencv/opencv/issues/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
2025-06-02 11:23:38 +03:00
Vincent Rabaud
4033043488 Fix empty ND-array construction 2025-06-02 10:13:49 +02:00
Maxim Smolskiy
e92cfb35f6
Merge pull request #27389 from MaximSmolskiy:add_HoughCirclesWithAccumulator_binding
Add HoughCirclesWithAccumulator binding #27389

### Pull Request Readiness Checklist

Fix #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
2025-06-02 10:23:17 +03:00
Alexander Smorkalov
a39f61b6e1
Merge pull request #27390 from MaximSmolskiy:update_HoughLinesWithAccumulator_binding
Update HoughLinesWithAccumulator binding
2025-06-02 09:41:33 +03:00
MaximSmolskiy
e1f6e85c88 Update HoughLinesWithAccumulator binding 2025-06-01 19:19:21 +03:00
Alexander Smorkalov
b3cb517cac
Merge pull request #27385 from CodeLinaro:doc_update
Updating doc markdown to include API in FastCV gemm HAL
2025-05-30 15:24:15 +03:00
Liane Lin
8a0ea789e7
Merge pull request #27149 from liane-lin:4.x
Fix #25696: Solved the problem in Subdiv2D, empty delaunay triangulation #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
2025-05-30 15:20:01 +03:00
Aditi Sharma
d26aa99a05 Updating doc markdown to include API in FastCV gemm HAL 2025-05-30 17:01:07 +05:30
Alexander Smorkalov
9f7793cdae
Merge pull request #27375 from CodeLinaro:doc_update
Updating doc markdown to include newly added FastCV HAL and Extension…
2025-05-28 16:06:42 +03:00
Aditi Sharma
47d0bedeb2 Updating doc markdown to include newly added FastCV HAL and Extension APIs 2025-05-28 15:43:04 +05:30
Myron Rodrigues
344f8c6400
Merge pull request #27363 from MRo47:openvino-npu-support
Feature: Add OpenVINO NPU support #27363

## Why
- OpenVINO now supports inference on integrated NPU devices in intel's Core Ultra series processors.
- Sometimes as fast as GPU, but should use considerably less power.

## How
- The NPU plugin is now available as "NPU" in openvino `ov::Core::get_available_devices()`.
- Removed the guards and checks for NPU in available targets for Inference Engine backend.

## Test example

### Pre-requisites
- Intel [Core Ultra series processor](https://www.intel.com/content/www/us/en/products/details/processors/core-ultra/edge.html#tab-blade-1-0)
- [Intel NPU driver](https://github.com/intel/linux-npu-driver/releases)
- OpenVINO 2023.3.0+ (Tested on 2025.1.0)

### Example
```cpp
#include <opencv2/dnn.hpp>
#include <iostream>

int main(){
    cv::dnn::Net net = cv::dnn::readNet("../yolov8s-openvino/yolov8s.xml", "../yolov8s-openvino/yolov8s.bin");
    cv::Size net_input_shape = cv::Size(640, 480);
    std::cout << "Setting backend to DNN_BACKEND_INFERENCE_ENGINE and target to DNN_TARGET_NPU" << std::endl;
    net.setPreferableBackend(cv::dnn::DNN_BACKEND_INFERENCE_ENGINE);
    net.setPreferableTarget(cv::dnn::DNN_TARGET_NPU);

    cv::Mat image(net_input_shape, CV_8UC3);
    cv::randu(image, cv::Scalar(0, 0, 0), cv::Scalar(255, 255, 255));
    cv::Mat blob = cv::dnn::blobFromImage(
        image, 1, net_input_shape, cv::Scalar(0, 0, 0), true, false, CV_32F);
    net.setInput(blob);
    std::cout << "Running forward" << std::endl;
    cv::Mat result = net.forward();
    std::cout << "Output shape: " << result.size << std::endl; // Output shape: 1 x 84 x 6300
}
```

model files [here](https://limewire.com/d/bPgiA#BhUeSTBnMc)

docker image used to build opencv: [ghcr.io/mro47/opencv-builder](https://github.com/MRo47/opencv-builder/blob/main/Dockerfile)

Closes #26240

### 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-05-27 14:13:49 +03:00
Alexander Smorkalov
a23baceb06
Merge pull request #27367 from CodeLinaro:xuezha_markdown
update building_fastcv.markdown
2025-05-27 14:10:36 +03:00
Xue Zhang
17f399f475 update building_fastcv.markdown 2025-05-27 13:34:29 +05:30
Alexander Smorkalov
575e3adc01
Merge pull request #27345 from asmorkalov:as/android_sdk_fastcv
Fixed FastCV linkage in OpenCV4AndroidSDK
2025-05-25 10:13:00 +03:00
Alexander Smorkalov
7578007d23
Merge pull request #27356 from asmorkalov:as/ipp_hal_copyright
Added default copyright header to IPP HAL
2025-05-24 18:54:27 +03:00
Alexander Smorkalov
0806124ac7 Try to add FastCV to OpenCV4AndroidSDK 2025-05-24 18:49:11 +03:00
Alexander Smorkalov
b4944c9375 Added default copyright header to IPP HAL. 2025-05-24 16:57:49 +03:00
Alexander Smorkalov
0a5352ee27
Merge pull request #27346 from asmorkalov:as/ipp_hal_sum
New HAL entry for cv::sum and IPP adoption
2025-05-24 16:53:42 +03:00
Myron Rodrigues
374ad41420
Merge pull request #27353 from MRo47:fix/segfault-on-forward#27352
Fix #27352: Add checks before getting latest pin in Net::Impl::getLatestLayerPin() #27353 

### Pull Request Readiness Checklist

Fixes #27352 

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-05-24 10:07:45 +03:00
Maxim Smolskiy
023d14ecc4
Merge pull request #27347 from MaximSmolskiy:improve-solveCubic-accuracy
Improve solveCubic accuracy #27347

### Pull Request Readiness Checklist

Fix #27323 

```
2e-13 * x^3 + x^2 - 2 * x + 1 = 0 -> x^3 + 5e12 * x^2 - 1e13 * x + 5e12 = 0
```

The problem that coefficients have quite big magnitudes and current calculations are subject to round-off error

```
Q = (a1 * a1 - 3 * a2) * (1./9)
R = (2 * a1 * a1 * a1 - 9 * a1 * a2 + 27 * a3) * (1./54)
Qcubed = Q * Q * Q = a1^6/729 - (a1^4 a2)/81 + (a1^2 a2^2)/27 - a2^3/27
R * R = R^2 = a1^6/729 - (a1^4 a2)/81 + (a1^2 a2^2)/36 + (a1^3 a3)/27 - (a1 a2 a3)/6 + a3^2/4
d = Qcubed - R * R
```

Let `a1`, `a2`, `a3` have quite big same magnitudes, then we see that `Qcubed` and `R * R` have same terms `a1^6/729` and `-(a1^4 a2)/81` (which will be reduced in `d`), but they level out the other terms (these terms have `6`th and `5`th degree and other terms - less or equal than `4`th degree).
So, if these terms will participate in the calculation, this will lead to a huge round-off error.
But if we expand the expression, then round-off error should be less
```
d = Qcubed - R * R = 1/108 (a1^2 a2^2 - 4 a2^3 - 4 a1^3 a3 + 18 a1 a2 a3 - 27 a3^2)
```

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-05-24 09:56:48 +03:00
Alexander Smorkalov
388b6dd81f New HAL entry for cv::sum and IPP adoption. 2025-05-23 12:35:11 +03:00
Alexander Smorkalov
b8099d3cc2
Merge pull request #27348 from fengyuentau:4x/hal/riscv_rvv/faster_div_f32
hal/riscv-rvv: further optimize div
2025-05-23 11:31:16 +03:00
Alexander Smorkalov
5a457842f1
Merge pull request #27351 from mshabunin:fix-intrin-legacy-ops-2
core: legacy intrin operators - fixed version warning condition
2025-05-23 07:50:39 +03:00
Maksim Shabunin
e6fb6c290c core: legacy intrin operators - fixed version warning condition 2025-05-22 21:00:49 +03:00
Yuantao Feng
2c4eab0969 perf: speed up vfdiv by Newton-Raphson routine 2025-05-22 12:58:40 +08:00
Alexander Smorkalov
aee828ac6e
Merge pull request #27344 from asmorkalov:as/kleidicv_no_cv_namespace
Disabled cv namespace usage inside KleidiCV.
2025-05-21 16:13:48 +03:00
Yuantao Feng
c37f54aeed
Merge pull request #27343 from fengyuentau:4x/build/fix_more_warnings
build: fix more warnings from recent gcc versions after #27337 #27343

More fixings after https://github.com/opencv/opencv/pull/27337

### 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-05-21 16:12:09 +03:00
Alexander Smorkalov
7ecb1d8cab Disabled cv namespace usage inside KleidiCV. 2025-05-21 13:04:23 +03:00