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

3633 Commits

Author SHA1 Message Date
TonyCY24 4eb5345e29 Merge pull request #28053 from TonyCY24:docs/mask-rcnn-compatibility
samples: add compatibility note for Mask R-CNN in OpenCV 5.0 #28053

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

### Summary
Updates documentation in `samples/dnn/mask_rcnn.py` to clarify a compatibility issue with OpenCV 5.0.

### Details
As verified in issue #27240, OpenCV 5.0 introduces stricter graph optimization. The default `.pbtxt` used in this sample treats `detection_out_final` as an intermediate layer (it is not listed in `getUnconnectedOutLayersNames`).

While OpenCV 4.x implicitly allows retrieving this layer, OpenCV 5.0 throws an error when requesting it:
> "the number of requested and actual outputs must be the same"

This PR adds:
1. A warning note in the file header explaining the strict output requirement.
2. An inline comment near `net.forward()` to guide users debugging this error.

Relates to issue: #27240
2025-11-21 12:55:27 +03:00
Alexander Smorkalov 1b6fb61b89 Merge branch 4.x 2025-11-18 08:51:08 +03:00
happy-capybara-man db207c88b0 Merge pull request #27985 from happy-capybara-man:docs/fix-mat-clone-js
docs(js): Fix Mat.clone() documentation to use mat_clone() for deep copy #27985

- Update code example to use ```mat_clone()``` instead of ```clone()```
- Add explanatory note about shallow copy issue due to Emscripten embind
Problem
- OpenCV.js documentation shows ```Mat.clone()``` usage, but this method performs shallow copy instead of deep copy due to Emscripten embind limitations, causing unexpected behavior where modifications to cloned matrices affect the original.

Related Issues and PRs
- Fixes documentation aspect of issue #27572
- Related to PR #26643 (js_clone_fix)

### 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-10 10:47:40 +03:00
Alexander Smorkalov 14eb474a75 Merge pull request #27932 from asmorkalov:as/pylint_fix
Pylint warnings fix in the new visualization sample.
2025-10-23 12:34:07 +03:00
Alexander Smorkalov 82fe39760a Pylint warnings fix in the new visualization sample. 2025-10-23 10:22:46 +03:00
Alexander Smorkalov 98bf72b319 Merge branch 4.x 2025-10-23 08:11:04 +03:00
Skreg 0fb49827c1 Merge pull request #27627 from shyama7004:multicamVis
Visualization script for one or more cameras calibration with calibration.cpp #27627

* It reads one or more YAML files produced by `calibration.cpp`.
* displays an interactive 3D scene of the calibration setup with camera frustums and board meshes.
* Supports both **camera-centric** and **board-centric** views.
* exports the entire scene as a `.obj/.mtl` for use in meshlab.
* also includes an error bar plot and frustum highlighting for single-camera setups.

calibration results generated by `calibration.cpp`: https://drive.google.com/drive/folders/13NvZHaxTFdAB-bzlNve8kKSMIg9gAu6K

Results Uploaded at: https://drive.google.com/drive/folders/1fkFyoBRGcNY4UCQhGgadO6uKlAkrzjTe
### 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-10-20 08:42:06 +03:00
Dave Merchant 0ee9c27966 Merge pull request #27810 from D00E:known-foreground-mask
2025-10-14T05:53:31.5387050Z C:\GHA-OCV-1\_work\ci-gha-workflow\ci-gha-workflow\opencv\modules\imgcodecs\src\bitstrm.cpp(156,57): warning C4244: 'argument': conversion from 'int64_t' to 'ptrdiff_t', possible loss of data [C:\GHA-OCV-1\_work\ci-gha-workflow\ci-gha-workflow\build\modules\imgcodecs\opencv_imgcodecs.vcxproj]

### Pull Request Readiness Checklist

Optional Known Foreground Mask for Background Subtractors #27810

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

### Description
This adds an optional foreground input mask parameter to the MOG2 and KNN background subtractors, in line with issue https://github.com/opencv/opencv/issues/26476

4 tests are added under test_bgfg2.cpp:
2 for each subtractor type (1 with shadow detection and 1 without)
A demo shows the feature with only 3 parameters and with a 4th optional foreground mask for both core subtractor types.

Note: To patch contrib inheritance of the background subtraction class, empty apply method which throws a not implemented error is added to contrib subclasses. This is done to keep the overloaded apply function as pure virtual. Contrib PR to be made and linked shortly.  
Contrib Repo Paired Pull Request: https://github.com/opencv/opencv_contrib/pull/4017
2025-10-14 09:56:06 +03:00
Alexander Smorkalov 1c1d2f923b Merge branch 4.x 2025-10-08 14:55:14 +03:00
Alexander Smorkalov 9c33ddea31 Merge pull request #27874 from asmorkalov:as/3dobject_pose
3D object pose estimation tutorial update #27874

1. Use cv::loadMesh instead of custom csv-based reader.
2. Use code snippets

### 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-06 15:20:06 +03:00
D00E acc76304d5 Updated Tutorial PSNR for identical images 2025-10-02 00:03:28 +01:00
Alexander Smorkalov da8c313a90 Merge pull request #27749 from MykhailoTrushch:fc4
Add auto white balance DNN algorithm FC4
2025-09-29 16:16:23 +03:00
MykhailoTrushch 289c9accad Added fc4 auto white balance dnn sample 2025-09-29 11:34:04 +03:00
Alexander Smorkalov a6c88cde7f Converted multiview calibration sample to application. 2025-09-29 10:24:14 +03:00
Alexander Smorkalov 1a74264ee9 Merge branch 4.x 2025-09-26 12:10:49 +03:00
Alexander Smorkalov 6a9aa0aba2 Added info logs with intermediate values to multiview calibration and related script option. 2025-09-19 12:27:17 +03:00
Alexander Smorkalov 07b7dd02cd Merge pull request #27792 from asmorkalov:as/multiview_stereo_init
Added option to initialize pairs with stereo and fixed related bugs.
2025-09-19 12:22:37 +03:00
Alexander Smorkalov 619f47d78a Fixed cameras name loading in multiview camera visualization. 2025-09-18 21:20:42 +03:00
Alexander Smorkalov 96c2365d5f Added option to initialize pairs with stereo and fixed related bugs. 2025-09-17 18:59:43 +03:00
Alexander Smorkalov 16bb0600bd Use clustering for findCirclesGrid in multiview calibration to get rid of pattern flip. 2025-09-17 10:47:25 +03:00
Alexander Smorkalov 8a039b4586 Dump per-camera RMS for multiview calibration. 2025-09-15 15:47:48 +03:00
Alexander Smorkalov d1a5723864 Merge branch 4.x 2025-09-09 10:27:19 +03:00
Naresh M L 99a8d4b762 Merge pull request #27592 from Naresh-19:dnn-sample-seemore-sr
Added image super-resolution samples using seemoredetails model #27592

Based on "See More Details: Efficient Image Super-Resolution by Experts Mining" (ICML 2024)

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

This pull request adds a new sample named seemore_superres under samples/dnn/, implemented in both Python and C++.  
The sample demonstrates image super-resolution using the Seemoredetails model with OpenCV’s DNN module.

### Files Added:
- samples/dnn/seemore_superres.cpp
- samples/dnn/seemore_superres.py
- Updated samples/dnn/models.yml

### Functionality:
- Performs image upscaling(4x) using a specified Seemoredetails ONNX model.
- Accepts image path and ONNX model path as command-line arguments.
- Outputs the original and super-resolved images side by side for visual comparison.

### Sample Usage:
*C++*

./seemore_superres --input=path/to/image.jpg
`

*Python*

python seemore_superres.py --input=path/to/image.jpg
`
2025-08-20 12:11:49 +03:00
Skreg 86b9885c90 Merge pull request #27651 from shyama7004:minor-fixes
Fix empty intrinsics handling and minor calibration improvements #27651

Closes: #27650

Minor changes:
* Filter out `""` in `files_with_intrinsics`.
* Match the list length with the number of cameras.
* Fix unpacking from `cv.calibrateMultiviewExtended`.
* Adjust visualisation to ensure correct shapes.
* Save `cam_ids` as a list in YAML.
* Removed typos.

<details>
<summary>Pytest</summary>

```py
import json
import numpy as np
import importlib.util
import sys
import pytest

spec = importlib.util.spec_from_file_location("mv", "multiview_calibration.py")
mv = importlib.util.module_from_spec(spec)
sys.modules["mv"] = mv
spec.loader.exec_module(mv)

def test_insideImageMask_boundaries():
    # w = 10, h = 10, valid x,y: [0..9]
    pts = np.array([[0, 5, 9, -1, 10],
                    [0, 5, 9,  5,  5]], dtype=np.int32)
    m = mv.insideImageMask(pts, 10, 10)
    assert m.tolist() == [True, True, True, False, False]

def test_intrinsics_empty_ignored_and_forwarded(tmp_path, monkeypatch):
    cam1 = tmp_path / "cam1.txt"
    cam2 = tmp_path / "cam2.txt"
    cam1.write_text("\n")
    cam2.write_text("\n")

    opened = []

    class FakeNode:
        def __init__(self, name):
            self.name = name
        def mat(self):
            if self.name in ("camera_matrix", "cameraMatrix"):
                return np.eye(3, dtype=np.float32)
            if self.name in ("dist_coeffs", "distortion_coefficients"):
                return np.zeros((1, 5), dtype=np.float32)
            return None

    class FakeFS:
        def __init__(self, filename, flags=None):
            opened.append(filename)
        def getNode(self, key):
            return FakeNode(key)

    monkeypatch.setattr(mv.cv, "FileStorage", FakeFS)

    captured = {}
    def fake_calibrateFromPoints(pattern_points, image_points, image_sizes, models,
                                 image_names, find_intrinsics_in_python, Ks=None, distortions=None):
        captured["Ks"] = Ks
        captured["dist"] = distortions
        return dict(
            Rs=[np.zeros((3, 1)) for _ in models],
            Ts=[np.zeros((3, 1)) for _ in models],
            Ks=Ks,
            distortions=distortions,
            rvecs0=[np.zeros((3, 1))],
            tvecs0=[np.zeros((3, 1))],
            errors_per_frame=np.ones((len(models), 1), dtype=np.float32),
            output_pairs=[],
            image_points=image_points,
            models=models,
            image_sizes=image_sizes,
            pattern_points=pattern_points,
            detection_mask=np.ones((len(models), 1), np.uint8),
            image_names=image_names,
        )

    monkeypatch.setattr(mv, "calibrateFromPoints", fake_calibrateFromPoints)

    out = mv.calibrateFromImages(
        files_with_images=[str(cam1), str(cam2)],
        grid_size=[3, 2],
        pattern_type="checkerboard",
        models=[0, 0],
        dist_m=0.1,
        winsize=(5, 5),
        points_json_file="",
        debug_corners=False,
        RESIZE_IMAGE=False,            # <- match real signature name here
        find_intrinsics_in_python=False,
        is_parallel_detection=False,
        cam_ids=["1", "2"],
        files_with_intrinsics=["", str(tmp_path / "intr.yml")],
        board_dict_path=None,
    )

    assert "" not in opened
    assert captured["Ks"] is not None and len(captured["Ks"]) == 2
    assert captured["dist"] is not None and len(captured["dist"]) == 2

def test_visualize_converts_rvec_to_R_and_t_to_col(monkeypatch):
    called = {}

    def fake_plotCamerasPosition(Rs, Ts, image_sizes, pairs, pattern, frame_idx, cam_ids, detection_mask):
        called["R_shapes"] = [R.shape for R in Rs]
        called["T_shapes"] = [T.shape for T in Ts]

    def fake_plotProjection(points_2d, pattern_points, rvec0, tvec0, rvec1, tvec1, K, dist_coeff, model, *rest):
        called["tvec1_shape"] = tvec1.shape
        called["K_shape"] = K.shape

    monkeypatch.setattr(mv.plt, "savefig", lambda *a, **k: None)
    monkeypatch.setattr(mv.plt, "close", lambda *a, **k: None)
    monkeypatch.setattr(mv, "plotCamerasPosition", fake_plotCamerasPosition)
    monkeypatch.setattr(mv, "plotProjection", fake_plotProjection)

    detection_mask = np.ones((1, 1), np.uint8)
    Rs = [np.zeros((3, 1), dtype=np.float32)]                  # rvec
    Ts = [np.array([[0., 0., 0.]], dtype=np.float32)]          # row 1x3
    Ks = [np.eye(3, dtype=np.float32)]
    distortions = [np.zeros((1, 5), dtype=np.float32)]
    models = [0]
    image_points = [[np.array([[10., 10.]], dtype=np.float32)]]
    errors_per_frame = np.array([[1.0]], dtype=np.float32)
    rvecs0 = [np.zeros((3, 1), dtype=np.float32)]
    tvecs0 = [np.zeros((3, 1), dtype=np.float32)]
    pattern_points = np.array([[0., 0., 0.]], dtype=np.float32)
    image_sizes = [(100, 100)]
    output_pairs = []
    image_names = None
    cam_ids = ["0"]

    mv.visualizeResults(
        detection_mask, Rs, Ts, Ks, distortions, models,
        image_points, errors_per_frame, rvecs0, tvecs0,
        pattern_points, image_sizes, output_pairs, image_names, cam_ids
    )

    assert called["R_shapes"] == [(3, 3)]
    assert called["T_shapes"] == [(3, 1)]
    assert called["tvec1_shape"] == (3, 1)
    assert called["K_shape"] == (3, 3)
```
</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
- [ ] 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-08-18 19:28:08 +03:00
Alexander Smorkalov 52ae1cfc29 Fixed logical error in camera calibration tutorial. 2025-08-18 13:07:09 +03:00
Harii Sankar S 9bb330af5f Merge pull request #27593 from HarxSan:alpha_matting_sample
Add Alpha matting samples (C++ and Python) #27593

### 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-08-12 19:14:29 +03:00
Alexander Smorkalov f4538f5020 Expose Orbbec color camera distortion coefficients as API. 2025-08-12 15:46:28 +03:00
Alexander Smorkalov 02f0779d0e Merge branch 4.x 2025-08-07 10:35:20 +03:00
Alexander Smorkalov 9f88e9ae31 Added options to initialize Orbbec cameras with custom fps and resolution. 2025-08-05 17:29:29 +03:00
Alexander Smorkalov 3b2d7b3f1b Merge branch 4.x 2025-07-28 10:04:17 +03:00
Alexander Smorkalov d977b02297 Reworks pre-computed intrinsiscs support in multi-view calibration script. 2025-07-25 12:50:50 +03:00
Alexander Smorkalov ac9d0e0d0d Removed hack for calibration boards in samples and tutorials. 2025-07-24 11:27:20 +03:00
Alexander Smorkalov bd67770dcb Merge branch 4.x 2025-07-22 09:47:19 +03:00
Yan Wen f54286b672 Merge pull request #27453 from MELSunny:4.x
Add Raspberry Pi 4 and 5 V4L2 Stateless HEVC Hardware Acceleration with FFmpeg #27453

This PR enables V4L2 stateless HEVC hardware acceleration for Raspberry Pi 5 within OpenCV's videoio module. It leverages FFmpeg's drm acceleration ([FFmpeg API changes](https://github.com/FFmpeg/FFmpeg/blob/ee1f79b0fa4c82da9c19328b049b593c71611402/doc/APIchanges#L1529)), significantly improving HEVC decoding performance on RPi5 for robotics and embedded vision applications.

I have a working proof-of-concept with local benchmarks showing clear gains.

Checklist Status:

Ready: License, branch (4.x), FFmpeg reference, and (linked) related issue (#27452).
Seeking Guidance: Need help with formal C++ performance/accuracy tests, opencv_extra integration, and full documentation/examples.
As a Python developer, I welcome C++ best practice feedback and assistance with testing setup.

### 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-07-18 11:19:58 +03:00
ClaudioMartino 6a5884c04f New normalization in histogram comparison tutorial to use KV divergence
The Kullback-Leibler divergence works with histogram that have integral = 1,
otherwise it can return negative values. The normalization of the histograms
have been changed accordingly, and all the six comparison methods have been
used in the histogram comparison tutorial.
2025-07-07 08:43:16 +02:00
krikera 27867cc72c Add MORPH_DIAMOND support to samples and tutorials 2025-06-27 21:09:53 +05:30
leopardracer bbaed6f377 Merge pull request #27455 from leopardracer:4.x
Fix Typos in Comments and Documentation #27455

Description:
This pull request corrects minor typos in comments and documentation within the codebase:
- Replaces "representitive" with "representative" in kmeans.cpp.
- Replaces "indices" with the correct spelling in a comment in main.cu.
2025-06-18 15:28:25 +03:00
Maxim Evtush f09de671be Update person_reid.py 2025-06-16 12:09:29 +03:00
kilavvy c5ef3948cf Update CMakeLists.txt 2025-06-12 17:03:07 +02:00
Gursimar Singh 425d5cfcf0 Merge pull request #27051 from gursimarsingh:move_ccm_to_photo_module
Adding color correction module to photo module from opencv_contrib #27051

This PR moved color correction module from opencv_contrib to main repo inside photo module.

### 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-12 17:07:16 +03:00
leopardracer b395a2e307 Merge pull request #27434 from leopardracer:4.x
Fix Typos in Comments and Error Messages Across Multiple Files #27434
 
Description:  
This pull request corrects several typographical errors in comments and error messages in the following files:
- `samples/directx/d3d11_interop.cpp`: Fixed typo in the error message ("betweem" → "between").
- `samples/dnn/yolo_detector.cpp`: Fixed typo in a comment ("elemets" → "elements").
- `samples/winrt/ImageManipulations/MediaExtensions/OcvTransform.cpp`: Fixed typo in a comment ("peferred" → "preferred").

These changes improve code readability and maintain consistency in documentation and error reporting. No functional code was modified.
2025-06-11 16:19:05 +03:00
Alexander Smorkalov dd87ffc340 Merge branch 4.x 2025-06-11 15:55:42 +03:00
Abhishek Gola ef9b42c05a Merge pull request #27349 from abhishek-gola:deblurring_onnx_sample
Added DNN based deblurring samples #27349

Corresponding pull request adding quantized onnx model to opencv_zoo: https://github.com/opencv/opencv_zoo/pull/295

Model size: 88MB

### 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-11 13:29:06 +03:00
Alexander Smorkalov 350b211b57 Merge branch 4.x 2025-06-10 10:16:50 +03:00
Kavyansh Tyagi b13704b583 Fix coordinate generation in drawing sample 2025-06-09 23:43:34 +05:30
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 https://github.com/opencv/opencv/commit/833f8d16fab5e57c5e800a55fa0fb08c7a31c3b1), which was moved to opencv_contrib a long time ago in this commit: https://github.com/opencv/opencv/commit/742f22c09bd0c27b450f141bc984f280c8cde98e. 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
Ken Shirriff d5a5b0e85f Update match_template.py to fix doc bug
shape has Y first, then X. See issue #27292
2025-05-12 17:06:24 +03:00
Alexander Smorkalov f8de2e06e6 Merge branch 4.x 2025-05-07 13:17:42 +03:00
nina16448 6f8f846288 Update houghcircles.py 2025-04-25 15:39:50 +08:00
Gursimar Singh bbd36a0ec1 Merge pull request #27246 from gursimarsingh:bug_fix/mcc_dnn_dependency
Fix hard dependency of dnn for mcc module. #27246

Currently building objdetect module without dnn fails due to mcc module. This PR makes the dependency optional, by checking if DNN is available in mcc module. 

### 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-04-22 08:27:36 +03:00