modified: helloworld.py modified: main_windows/main_window.py new file: nst/1.jpg modified: nst/Models.pymaster
parent
23d27c297a
commit
d22d223d6d
@ -1,21 +1,6 @@
|
|||||||
import cv2
|
import cv2
|
||||||
|
import torch
|
||||||
|
|
||||||
|
print(torch.__version__)
|
||||||
def detect_cameras(max_cameras=10):
|
use_cuda = torch.cuda.is_available() # 是否有可用的gpu
|
||||||
cameras = []
|
print(use_cuda)
|
||||||
for i in range(max_cameras):
|
|
||||||
cap = cv2.VideoCapture(i)
|
|
||||||
if cap is None or not cap.isOpened():
|
|
||||||
cap.release()
|
|
||||||
else:
|
|
||||||
cameras.append(i)
|
|
||||||
cap.release()
|
|
||||||
return cameras
|
|
||||||
|
|
||||||
|
|
||||||
# available_cameras = detect_cameras()
|
|
||||||
# print(f'Found {len(available_cameras)} camera(s): {available_cameras}'
|
|
||||||
|
|
||||||
image = cv2.imread("nst/ori/1.jpg")
|
|
||||||
cv2.imshow("Image", image)
|
|
||||||
cv2.waitKey(0)
|
|
||||||
|
Loading…
Reference in new issue