有無 ching 玩緊 OpenCV?

有個 project 想用 OpenCV 做 D 簡單既 object detection 既野, 之前用隻唔知買乜送既 cam 太舊, cap 圖太細, 效果唔理想.
剛剛買左隻  C270, 諗住平平地 720p 試下先.  但試左好耐, 只要高過 640X480 就出 error.
上網搵下, 有人話係 logitech 既 driver 限左 640X480.  係就中招了, 又要買過.

唔知有無 ching 玩緊 OpenCV, 知唔知係咪 logitech driver 限左, 定係 openCV 限左個 resolution.
家陣用緊 python 3 既 cv2, 4.1.0, 應該係最新了, 如果係 cv2 問題就無得諗了.
如果只係 logitech 既問題, 唔知有無邊隻 cam 行 OpenCV 可以直接 cap 到 720p 或以上既圖?  唔該哂.

someone said if you set width & height to a unreasonable high value, it will set to 1280*720

TOP

someone said if you set width & height to a unreasonable high value, it will set to 1280*720
ylimny 發表於 2019-7-27 21:25


no, I have tested all supported resolution, and it will return error for those higher than 640 x 480.

720p (1280 x 720) is the maximum for C270 (in fact, it also support 1280x960 when using windows 10  camera app), but it can't be set via opencv command,
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)

The following error is returned:
[ WARN:0] videoio(MSMF): OnReadSample() is called with error status: -1072875855


The maximum resolution can be used is 640x480.
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)

TOP

本帖最後由 ylimny 於 2019-7-27 21:43 編輯

回覆 3# Super169
you are using MSMF, you may try to use DirectShow

cam = cv2.VideoCapture(0,cv2.CAP_DSHOW)

ref: https://docs.opencv.org/3.4/d0/da7/videoio_overview.html

TOP

回覆 4# ylimny

Oh, yes, it works with Direct Show  even in 1280 x 960.  
Thanks a lot!  

TOP