Repository: opencv
Issue: MacOS: OpenCL error CL_INVALID_VALUE in findChessboardCornersSB
Labels: bug,platform: ios/osx,category: ocl

This has already been reported before in https://answers.opencv.org/question/232189/opencl-error-cl_invalid_value-in-findchessboardcornerssb/
I ran into this now and dove a little deeper and got to 
> parallel_for_(Range(parameters.min_scale,parameters.max_scale+1),[&](const Range& range){
in chessboard.cpp line 722

The error received is 'CL_INVALID_VALUE (-30) during call: clCreateProgramWithBinary' looking that one up in https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/clCreateProgramWithBinary.html it says ' if device_list is NULL or num_devices is zero;' so it cannot find anything to parallellize it on. Now I also see that OpenCL is no longer supported on Mac since macOS 10.14 so I wonder if this should be solved by removing/replacing OpenCL

##### System information (version)
<!-- Example
- OpenCV => 4.2
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2017
-->

- OpenCV => 4.5.2(but already seen in 4.3 works in 4.2)
- Operating System / Platform => MacOS 11.4
- Compiler => Xcode 12

##### Detailed description

<!-- your description -->

##### Steps to reproduce

minimal example:

```.cpp
#include <iostream>
#include <opencv2/opencv.hpp>

int main(int argc, const char * argv[]) {
    // insert code here...
    std::cout << "Hello, World!\n";
    cv::Mat img(cv::imread("checkerboard_radon.png", cv::IMREAD_GRAYSCALE));

    std::vector<cv::Point2f> corners;
    cv::Size inner_corners = { 14,9 }; // random, not important for the error as it happens earlier

    int flag = 0;
    flag |= cv::CALIB_CB_EXHAUSTIVE;
    flag |= cv::CALIB_CB_ACCURACY;

    auto found = cv::findChessboardCornersSB(img, inner_corners, corners, flag);
    if (found) {
        std::cout << corners[0].x << std::endl;
    }
    else{
        std::printf("nothing found");
    }
    return 0;
}
```


##### Issue submission checklist

 - [x] 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 question without real issue statement will be
   closed.
   -->
 - [x] I checked the problem with documentation, FAQ, open issues,
       forum.opencv.org, Stack Overflow, etc and have not found 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
   -->
 - [x] I updated to 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 latest release for each branch.
   The ticket is closed, if the problem is not reproduced with modern version.
   -->
 - [x] 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 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 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/
   -->