MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / get_num_devices

Method get_num_devices

monai/data/video_dataset.py:230–241  ·  view source on GitHub ↗

Get number of possible devices detected by OpenCV that can be used for capture.

()

Source from the content-addressed store, hash-verified

228
229 @staticmethod
230 def get_num_devices() -> int:
231 """Get number of possible devices detected by OpenCV that can be used for capture."""
232 if not has_cv2:
233 return 0
234 num_devices = 0
235 while True:
236 cap = cv2.VideoCapture(num_devices)
237 if not cap.read()[0]:
238 break
239 num_devices += 1
240 cap.release()
241 return num_devices
242
243 def __iter__(self):
244 frame_count = 0

Callers 1

Calls 1

readMethod · 0.45

Tested by

no test coverage detected