Skip to content

Commit

Permalink
Update videocapture_basic.cpp
Browse files Browse the repository at this point in the history
I believe you are using the wrong version of open() on line 28 - adding deviceID + appId together. It's better to use the new version of .open() taking two integers as parameter.
  • Loading branch information
HowardsPlayPen authored and asmorkalov committed Apr 24, 2020
1 parent e74075c commit cbcdbde
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions modules/videoio/doc/videoio_overview.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ For example to grab from default camera using Direct Show as backend

```cpp
//declare a capture object
cv::VideoCapture cap(0 + cv::CAP_DSHOW);
cv::VideoCapture cap(0, cv::CAP_DSHOW);

//or specify the apiPreference with open
cap.open(0 + cv::CAP_DSHOW);
cap.open(0, cv::CAP_DSHOW);
```
If you want to grab from a file using the Direct Show as backend:
Expand Down
2 changes: 1 addition & 1 deletion modules/videoio/src/cap_aravis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
// Please obvserve, that jumbo frames are required when high fps & 16bit data is selected.
// (camera, switches/routers and the computer this software is running on)
//
// Basic usage: VideoCapture cap(CAP_ARAVIS + <camera id>);
// Basic usage: VideoCapture cap(<camera id>, CAP_ARAVIS);
//
// Supported properties:
// read/write
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp/videocapture_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(int, char**)
int deviceID = 0; // 0 = open default camera
int apiID = cv::CAP_ANY; // 0 = autodetect default API
// open selected camera using selected API
cap.open(deviceID + apiID);
cap.open(deviceID, apiID);
// check if we succeeded
if (!cap.isOpened()) {
cerr << "ERROR! Unable to open camera\n";
Expand Down

0 comments on commit cbcdbde

Please sign in to comment.