-
Notifications
You must be signed in to change notification settings - Fork 36
deduplicate configuration and ensure it works on enumerate_camera_devices #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
ccf8839 to
e0a941c
Compare
enumerate_camera_devices previously did not check if a camera configuration worked. This resulted in users being presented with a set of configurations, some of which did not work. enumerate_camera_devices now attempted to capture a frame. If this does not work the configuration is not returned. This greatly reduces the number of "false" configurations. However there are some configurations which do not track but are still appended, I am unsure how to test these without requiring the camera be pointed at a person on startup.
e0a941c to
3234114
Compare
|
@Drikanis could you test with this commit also with this patch applied diff --git c/Mods/MediaPipe/_tracker/Project/new_tracker.py w/Mods/MediaPipe/_tracker/Project/new_tracker.py
index 2f0ebba..1bfc7f0 100644
--- c/Mods/MediaPipe/_tracker/Project/new_tracker.py
+++ w/Mods/MediaPipe/_tracker/Project/new_tracker.py
@@ -12,6 +12,8 @@ import threading
import time
import traceback
+os.environ["OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS"] = "0"
+
import cv2
import kiri_math
import mediapipe
@@ -796,7 +798,7 @@ def enumerate_camera_devices():
capture_api_preference = cv2.CAP_V4L2
if sys.platform == "win32":
- capture_api_preference = cv2.CAP_DSHOW
+ capture_api_preference = cv2.CAP_MSMF
# On Linux, we sometimes see stuff showing up as just "video#", so
# let's at least try to correlate paths and IDs from
|
commit 4312946
Tracking still takes a really long time to start (1-2 minutes), and appears to be dropping packets consistently once it starts.
after patch
Tracking starts immediately, but still appears to be dropping packets consistently.
|
4312946 to
82aabb8
Compare
I'm not sure if this is actually an issue because this has been how things have been for me from day one. Kiri would need to confirm. |
|
After a little more research what I believe is happening is the following, without |
|
Or CAP_ANY was slower than "direct" MSMF? If the dropped frames are benign (which it seems to be) then I guess they can be ignored. Aside from the loss of DSHOW-exclusive devices and the version bump on the project file, it seems fine from a testing perspective. |
|
Oh that was my bad, I'll remove those changed files. If there's a similar issue of duplicate cameras on macos I can't fix it. Someone with a apple device would need fo. Other then that I believe this can be merged in? |
If a device is busy(i.e) used by another device assume it works, to tests this we check if we can open it using linuxpy and assume the configuration works if we get a errno = 16 which is "Device or resource busy"
On windows CAP_ANY returns 2 "entries" for every camera. Direct Show (DSHOW) and Media Foundation (MSMF) MSMF was introduced in windows vista and DSHOW has since been deprecated and its docs carry the warning it maybe ripped out in a future windows version. For future readiness only filter by CAP_MSMF.
We now set OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS to "0" to fix the performance issues based on https://github.com/opencv/opencv/issues/17687\ This for reasons beyond my understanding fixes the issue.
82aabb8 to
003daa3
Compare
|
@ExpiredPopsicle can you look at this when you're free |
|
On my end this fails with... |
|
This also intentionally breaks DSHOW compatibility, which I would like to leave in solely because DSHOW works with WINE while MSMF did not, the last time I checked. I don't know who's running SnekStudio under WINE and why they would do it, but I don't like the idea of intentionally removing a functioning fallback. |
If CAP_MSMF fails to get any cameras we now enumerate cameras using DSHOW preserving the ability to run snudio in wine(if anyone is actually doing that)
|
@ExpiredPopsicle messed up reverting a change and now there's a updated |






Linux
enumerate_camera_devices previously did not check if a camera configuration worked. This resulted in users being presented with a set of configurations, some of which did not work. enumerate_camera_devices now attempted to capture a frame. If this does not work the configuration is not returned.
This greatly reduces the number of "false"/non working configurations. However there are some configurations which do not track but are still appended, I am unsure how to test these without requiring the camera be pointed at a person on startup.
before:

after:

windows
On windows CAP_ANY returns 2 "entries" for every camera. Direct Show(DSHOW) and Media Foundation (MSMF) MSMF was introduced in windows vista and DSHOW has since been deprecated and its docs carry the warning it maybe ripped out in a future windows version. For future readiness only query by CAP_MSMF since that provides windows support