OpenCV4 0開啟指定USB攝像頭問題

2021-09-21 14:21:39 字數 442 閱讀 8067

網上查了些資料,試圖通過usb攝像頭名稱獲取index,從而開啟指定攝像頭,**如下:

std::vectorlist;

listdevices(list);

for (int i=0; i編譯通過後挺好使,誰知第二天重新開機,竟然開啟的是另外的usb攝像頭!!!

追蹤半天沒發現異常,只能得出結論是listdevice得到的index跟videocapture open的index不是同乙個index!!!

只好去看opencv文件:

listdevice是基於ds的,把open函式改為cap.open(camid,cv::cap_dshow);

一切正常!

opencv4 0棋盤格標定c

參考 修改 include include include include include using namespace cv using namespace std void m calibration vector filesname,size board size,size square s...

記VS2017使用opencv4 0安裝開發過程

四個地方 乙個是vs專案屬性中c directory的標頭檔案部分加上 e work software opencv build include opencv2 乙個是vs專案屬性中c directory的依賴庫目錄部分加上 e work software opencv build x64 vc14...

Ubuntu 下使用opencv開啟usb 攝像頭

ubuntu下opencv 安裝比較簡單,直接使用命令 sudo apt get install libopencv dev安裝後用簡單 進行測試 opencv test.cpp include include using namespace std using namespace cv int m...