Repository: opencv
Issue: cv::meanShift has an unknown error in opencv4.5.5
Labels: question (invalid tracker),category: 3rdparty

<!--
If you have a question rather than reporting a bug please go to https://forum.opencv.org where you get much faster responses.
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).

This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
-->

##### System information (version)
<!-- Example
- OpenCV => 4.2
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2017
-->

- OpenCV => :4.5.5:
- Operating System / Platform => :Windows 10:
- Compiler => :Clion+mingw:

##### Detailed description
![微信图片_20220605160400](https://user-images.githubusercontent.com/43124514/172041434-8fd51e95-01a5-46f6-9cf3-9bd3b4c5e6d0.png)
When i run my code include "meanShift()" function, the error will occur,
But this error just happen in OpenCV4.5.5. After i use OpenCV4.5.2 and OpenCV4.5.4, the bug disappear.
So that i wonder if this bug just happen in OpenCV4.5.5. Please check it, and reply me.Thanks.
<!-- your description -->

##### Steps to reproduce

<!-- to add code example fence it with triple backticks and optional file extension
    ```.cpp
    // C++ code example
    ```

 or attach as .txt or .zip file
-->
void QuickDemo::meanShiftTrack(Mat src) {
    Rect rect(148, 60, 42, 50);
    Mat roi = src(rect);
    int minSat = 65;
    Mat hsvroi;
    cvtColor(roi, hsvroi, COLOR_BGR2HSV);
    vector<Mat> images;
    split(hsvroi, images);
    Mat mask;
    threshold(images[1], mask, minSat, 255, THRESH_BINARY);
    const int channels[1] = {0};
    const int bins[1] = {256};
    float histRange[2] = {0, 180};
    const float *range[1] = {histRange};
    Mat hist;
    calcHist(&hsvroi, 1, channels, mask, hist, 1, bins, range);
    Mat dst = imread("D:/dst.png");
    Mat hsvdst;
    cvtColor(dst, hsvdst, COLOR_BGR2HSV);
    Mat result;
    calcBackProject(&hsvdst, 1, channels, hist, result, range, 255.0);
    TermCriteria criteria(TermCriteria::MAX_ITER | TermCriteria::EPS, 10, 1); 
    Rect init_rect(130, 98, 42, 50);
    meanShift(result,init_rect,criteria);
    imshow("result", result);
    rectangle(dst, init_rect, Scalar(0, 0, 255), 2);
    imshow("dst", dst);
}
##### Issue submission checklist

 - [ ] I report the issue, it's not a question
   <!--
   OpenCV team works with forum.opencv.org, Stack Overflow and other communities
   to discuss problems. Tickets with questions without a real issue statement will be
   closed.
   -->
 - [ ] I checked the problem with documentation, FAQ, open issues,
       forum.opencv.org, Stack Overflow, etc and have not found any solution
   <!--
   Places to check:
   * OpenCV documentation: https://docs.opencv.org
   * FAQ page: https://github.com/opencv/opencv/wiki/FAQ
   * OpenCV forum: https://forum.opencv.org
   * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
   * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
   -->
 - [ ] I updated to the latest OpenCV version and the issue is still there
   <!--
   master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
   OpenCV team supports only the latest release for each branch.
   The ticket is closed if the problem is not reproduced with the modern version.
   -->
 - [ ] There is reproducer code and related data files: videos, images, onnx, etc
   <!--
   The best reproducer -- test case for OpenCV that we can add to the library.
   Recommendations for media files and binary files:
   * Try to reproduce the issue with images and videos in opencv_extra repository
     to reduce attachment size
   * Use PNG for images, if you report some CV related bug, but not image reader
     issue
   * Attach the image as an archive to the ticket, if you report some reader issue.
     Image hosting services compress images and it breaks the repro code.
   * Provide ONNX file for some public model or ONNX file with random weights,
     if you report ONNX parsing or handling issue. Architecture details diagram
     from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
   -->