Commit Graph

312 Commits

Author SHA1 Message Date
Alexander Smorkalov
1c1d2f923b Merge branch 4.x 2025-10-08 14:55:14 +03:00
D00E
acc76304d5 Updated Tutorial PSNR for identical images 2025-10-02 00:03:28 +01: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
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
d977b02297 Reworks pre-computed intrinsiscs support in multi-view calibration script. 2025-07-25 12:50:50 +03:00
Alexander Smorkalov
bd67770dcb Merge branch 4.x 2025-07-22 09:47:19 +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
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
Alexander Smorkalov
dd87ffc340 Merge branch 4.x 2025-06-11 15:55:42 +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 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
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
69b91cabb4
Adding macbeth chart detector to objdetect module from opencv_contrib (#26906)
* Added mcc to opencv modules

* Removed color correction module

* Updated parameters return type

* Added python sample for macbeth_chart_detection

* Added models.yml support to samples

* Removed unnecessary headers and classes

* fixed datatype conversion

* fixed datatype conversion

* Cleaned headers and added reference/actual colors to samples

* Added mcc tutorial

* fixed datatype and header

* replaced unsigned with int

* Aligned actual and reference color function, added imread

* Fixed shadow variable

* Updated samples

* Added last frame colors prints

* updated detector class

* Added getter functions and useNet function

* Refactoring

* Fixes in test

* fixed infinite divison issue
2025-03-28 11:13:30 +03:00
shyama7004
ef474e06fc minor changes : Replace ndarray.ptp() with np.ptp() for NumPy 2.0 Compatibility 2025-03-23 23:38:33 +05:30
Skreg
4d15b2a33f
Merge pull request #26914 from shyama7004:log/linearPolar
Removal of deprecated functions in imgproc #26914
 
Fixes : #26410

### 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-02-18 14:03:45 +03:00
Alexander Smorkalov
55a2ca58f0 Merge branch 4.x 2025-02-05 09:28:27 +03:00
Suleyman TURKMEN
d9a139f9e8
Merge pull request #25608 from sturkmen72:animated_webp_support
Animated WebP Support #25608

related issues #24855 #22569 

### 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
2024-12-20 13:06:28 +03:00
Gursimar Singh
816851c999
Merge pull request #26202 from gursimarsingh:improved_tracker_samples
Improved Tracker Samples #26202

Relates to #25006

This sample has been rewritten to track a selected target in a video or camera stream. It combines VIT tracker, Nano tracker and Dasiamrpn tracker into one tracker sample

### 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-12-05 11:50:03 +03:00
WU Jia
614e250fd3
Merge pull request #26405 from kaingwade:rename_features2d
Rename features2d #26405

This PR renames the module _features2d_ to _features_ as one of the Big OpenCV Cleanup #25007. 
Related PR: opencv/opencv_contrib: [#3820](https://github.com/opencv/opencv_contrib/pull/3820) opencv/ci-gha-workflow: [#192](https://github.com/opencv/ci-gha-workflow/pull/192)
2024-11-12 11:04:48 +03:00
Alexander Smorkalov
8e55659afe Merge branch 4.x 2024-10-24 15:10:43 +03:00
WU Jia
ef98c25d60
Merge pull request #25292 from kaingwade:features2d_parts_to_contrib
Features2d cleanup: Move several feature detectors and descriptors to opencv_contrib #25292

features2d cleanup: #24999

The PR moves KAZE, AKAZE, AgastFeatureDetector, BRISK and BOW to opencv_contrib/xfeatures2d.

Related PR: opencv/opencv_contrib#3709
2024-10-10 17:10:22 +03:00
Suleyman TURKMEN
e72efd0d32
Merge pull request #26260 from sturkmen72:upd_doc_4_x
Update Documentation #26260

### 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
2024-10-09 09:09:51 +03:00
Alexander Smorkalov
110b701bba Multiple calibrateMultiview improvements.
- Added function overload for the simple case
- Added CV_Bool type support for masks
- `parallel_for_` for intrinsics calibration for faster inference
- Homogenize parameters order with other calibrateXXX functions
2024-10-04 14:07:17 +03:00
Alexander Smorkalov
3bcab8db0a
Merge pull request #26221 from asmorkalov:as/refactor_multiview_interface
Reworked multiview calibration interface #26221

- Use InputArray / OutputArray
- Use enum for camera type
- Sort parameters according guidelines
- Made more outputs optional
- Introduce flags and added tests for intrinsics and extrinsics guess.

### 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
2024-10-01 16:53:16 +03:00
Alexander Smorkalov
cb3af0a08f Merge branch 4.x 2024-09-23 14:18:25 +03:00
Onur Can KARAMAN
aa11a898a4 sample: tracker parameters updated
Signed-off-by: Onur Can KARAMAN <onurcankaraman340@gmail.com>
2024-09-14 23:36:57 +03:00
Alexander Smorkalov
100db1bc0b Merge branch 4.x 2024-08-28 15:06:19 +03:00
ericmariasis
cb72a2131f Added python branch to stitching tutorial. 2024-08-19 16:28:15 +03:00
Arvind Iyer
c9df679943
Merge pull request #25959 from arvind-iyer:4.x
Improved samples/python/tracker.py docstring #25959

This PR removed unused arguments and updated existing argument placeholders to be more descriptive of what they are.

### 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
2024-08-07 15:17:26 +03:00
Gursimar Singh
3dcc8c38b4
Merge pull request #25268 from gursimarsingh:samples_cleanup_python
Removed obsolete python samples #25268

Clean Samples #25006 
This PR removes 36 obsolete python samples from the project, as part of an effort to keep the codebase clean and focused on current best practices. Some of these samples will be updated with latest algorithms or will be combined with other existing samples. 

Removed Samples:

> browse.py
camshift.py
coherence.py
color_histogram.py
contours.py
deconvolution.py
dft.py
dis_opt_flow.py
distrans.py
edge.py
feature_homography.py
find_obj.py
fitline.py
gabor_threads.py
hist.py
houghcircles.py
houghlines.py
inpaint.py
kalman.py
kmeans.py
laplace.py
lk_homography.py
lk_track.py
logpolar.py
mosse.py
mser.py
opt_flow.py
plane_ar.py
squares.py
stitching.py
text_skewness_correction.py
texture_flow.py
turing.py
video_threaded.py
video_v4l2.py
watershed.py

These changes aim to improve the repository's clarity and usability by removing examples that are no longer relevant or have been superseded by more up-to-date techniques.
2024-07-31 16:11:00 +03:00
kaingwade
ca2d17758f Update orbbec(uvc) tutorial 2024-07-31 15:19:23 +08:00
Wanli
d231b4e362
Merge pull request #25503 from WanliZhong:remove_goturn
Remove goturn caffe model #25503

**Merged with:** https://github.com/opencv/opencv_extra/pull/1174
**Merged with:** https://github.com/opencv/opencv_contrib/pull/3729

Part of https://github.com/opencv/opencv/issues/25314

This PR aims to remove goturn tracking model because Caffe importer will be remove in 5.0

The GOTURN model will take **388 MB** of traffic for each download if converted to onnx. If the user wants to use the tracking method, we can recommend they use Vit or dasimRPN.

### 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
2024-05-06 11:57:30 +03:00
WU Jia
aa5ea340f7
Move objdetect HaarCascadeClassifier and HOGDescriptor to contrib xobjdetect (#25198)
* Move objdetect parts to contrib

* Move objdetect parts to contrib

* Minor fixes.
2024-03-21 23:40:10 +03:00
lpanaf
40dfe8e8fe Ground truth check and Charuco support in multiview_calibration.py 2024-02-28 10:31:56 +03:00
WU Jia
6722d4a524
Merge pull request #25017 from kaingwade:ml_to_contrib
Move ml to opencv_contrib #25017
OpenCV cleanup: #24997

opencv_contrib: opencv/opencv_contrib#3636
2024-02-27 15:54:08 +03:00
Rostislav Vasilikhin
f96111ef05
Merge pull request #24961 from savuor:rv/ply_mesh
PLY mesh support #24961

**Warning:** The PR changes exising API.

Fixes #24960
Connected PR: [#1145@extra](https://github.com/opencv/opencv_extra/pull/1145)

### Changes
* Adds faces loading from and saving to PLY files
* Fixes incorrect PLY loading (see issue)
* Adds per-vertex color loading / saving

### 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-02-12 15:34:54 +03:00
Alexander Smorkalov
163d544ecf Merge branch 4.x 2023-10-02 10:17:23 +03:00
lpylpy0514
70d7e83dca
Merge pull request #24201 from lpylpy0514:4.x
VIT track(gsoc realtime object tracking model) #24201

Vit tracker(vision transformer tracker) is a much better model for real-time object tracking. Vit tracker can achieve speeds exceeding nanotrack by 20% in single-threaded mode with ARM chip, and the advantage becomes even more pronounced in multi-threaded mode. In addition, on the dataset, vit tracker demonstrates better performance compared to nanotrack. Moreover, vit trackerprovides confidence values during the tracking process, which can be used to determine if the tracking is currently lost.
opencv_zoo: https://github.com/opencv/opencv_zoo/pull/194
opencv_extra: [https://github.com/opencv/opencv_extra/pull/1088](https://github.com/opencv/opencv_extra/pull/1088)

# Performance comparison is as follows:
NOTE: The speed below is tested by **onnxruntime** because opencv has poor support for the transformer architecture for now.

ONNX speed test on ARM platform(apple M2)(ms):
| thread nums | 1| 2| 3| 4|
|--------|--------|--------|--------|--------|
| nanotrack| 5.25| 4.86| 4.72| 4.49|
| vit tracker| 4.18| 2.41| 1.97| **1.46 (3X)**|

ONNX speed test on x86 platform(intel i3 10105)(ms):
| thread nums | 1| 2| 3| 4|
|--------|--------|--------|--------|--------|
| nanotrack|3.20|2.75|2.46|2.55|
| vit tracker|3.84|2.37|2.10|2.01|

opencv speed test on x86 platform(intel i3 10105)(ms):
| thread nums | 1| 2| 3| 4|
|--------|--------|--------|--------|--------|
| vit tracker|31.3|31.4|31.4|31.4|

preformance test on lasot dataset(AUC is the most important data. Higher AUC means better tracker):

|LASOT | AUC| P| Pnorm|
|--------|--------|--------|--------|
| nanotrack| 46.8| 45.0| 43.3|
| vit tracker| 48.6| 44.8| 54.7|

[https://youtu.be/MJiPnu1ZQRI](https://youtu.be/MJiPnu1ZQRI)
 In target tracking tasks, the score is an important indicator that can indicate whether the current target is lost. In the video, vit tracker can track the target and display the current score in the upper left corner of the video. When the target is lost, the score drops significantly. While nanotrack will only return 0.9 score in any situation, so that we cannot determine whether the target is lost.

### 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
- [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.
- [ ] The feature is well documented and sample code can be built with the project CMake
2023-09-19 15:36:38 +03:00
Alexander Smorkalov
fdab565711 Merge branch 4.x 2023-09-13 14:49:25 +03:00