提交 49432009 编写于 作者: A Alexander Alekhin

Merge pull request #21064 from alalek:doc_videoio_api_preference_3.4

......@@ -32,27 +32,26 @@ Select the backend at runtime
OpenCV automatically selects and uses first available backend (`apiPreference=cv::CAP_ANY`).
As advanced usage you can select the backend to use at runtime. Currently this option is
available only with %VideoCapture.
As advanced usage you can select the backend to use at runtime.
For example to grab from default camera using Direct Show as backend
For example to grab from default camera using Microsoft Media Foundation (MSMF) as backend
```cpp
//declare a capture object
cv::VideoCapture cap(0, cv::CAP_DSHOW);
cv::VideoCapture cap(0, cv::CAP_MSMF);
//or specify the apiPreference with open
cap.open(0, cv::CAP_DSHOW);
cap.open(0, cv::CAP_MSMF);
```
If you want to grab from a file using the Direct Show as backend:
If you want to grab from a file using the Microsoft Media Foundation (MSMF) as backend:
```cpp
//declare a capture object
cv::VideoCapture cap(filename, cv::CAP_DSHOW);
cv::VideoCapture cap(filename, cv::CAP_MSMF);
//or specify the apiPreference with open
cap.open(filename, cv::CAP_DSHOW);
cap.open(filename, cv::CAP_MSMF);
```
@sa cv::VideoCapture::open() , cv::VideoCapture::VideoCapture()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册