Repository: opencv
Issue: [iOS]VideoCapture resolution not settable with iOS
Labels: feature,priority: low,category: videoio(camera),platform: ios/osx

<!--
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.5.4
- Operating System / Platform => macOS Catalina 10.15.7
- Compiler => Xcode12.3
-->

- OpenCV => 4.5.4
- Operating System / Platform => macOS Catalina 10.15.7
- Xcode => 12.4
- CMake => 3.19.8
##### Detailed description

<!-- your description -->
CAP_PROP_FRAME_WIDTH and CAP_PROP_FRAME_HEIGHT properties of VideoCapture cannot be set to values other than ( w: 480 ) x ( h : 360 ). If I try to set CAP_PROP_FRAME_WIDTH to 1920 and CAP_PROP_FRAME_HEIGHT to 1080, it will set ( w: 480 ) x ( h : 360 ).
Also, the mat retrieved by the retrieve() method has the WIDTH and HEIGHT swapped. ( w: 360 ) x ( h : 480 )

It looks like the same issue as posted below.
https://forum.opencv.org/t/videocapture-resolution-not-settable-with-ios-c/1714

##### 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
-->

1. build opencv2.framework. 
`python opencv/platforms/ios/build_framework.py --contrib opencv_contrib --dynamic output`
2.  Open "output/samples/FaceDetection" project and edit ViewController.swift. https://github.com/opencv/opencv/blob/master/samples/swift/ios/FaceDetection/FaceDetection/ViewController.swift#L86
```
    @IBOutlet weak var cameraHolder: UIView!
    override func viewDidLoad() {
        super.viewDidLoad()
        
+        let cap = VideoCapture()
        
+        cap.set(propId: VideoCaptureProperties.CAP_PROP_FRAME_WIDTH.rawValue, value: 1920)
+        cap.set(propId: VideoCaptureProperties.CAP_PROP_FRAME_HEIGHT.rawValue, value: 1080)
        
+        cap.open(index: 0)
        
+        print("CAP_PROP_FRAME_WIDTH: \(cap.get(propId: VideoCaptureProperties.CAP_PROP_FRAME_WIDTH.rawValue))")
+        print("CAP_PROP_FRAME_HEIGHT: \(cap.get(propId: VideoCaptureProperties.CAP_PROP_FRAME_HEIGHT.rawValue))")
        
+        let mat: Mat = Mat()
+        cap.retrieve(image: mat)
        
+        print("mat.width(): \(mat.width())")
+        print("mat.height(): \(mat.height())")
    
        
        camera = CvVideoCamera2(parentView: cameraHolder)
        camera?.rotateVideo = true
        camera?.delegate = self
        camera?.start()
    }
```
3. Run FaceDetection project on device.
<img width="1279" alt="VideoCapture_ios_bug" src="https://user-images.githubusercontent.com/6204235/144750425-632fbec4-1364-4e8e-a29d-e8b5dcbf59cd.png">

```
CAP_PROP_FRAME_WIDTH: 480.0
CAP_PROP_FRAME_HEIGHT: 360.0
mat.width(): 360
mat.height(): 480
```

##### 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/
   -->