diff --git a/Core/UI/Images/icons/kiri_smug.png.import b/Core/UI/Images/icons/kiri_smug.png.import new file mode 100644 index 0000000..e420f78 --- /dev/null +++ b/Core/UI/Images/icons/kiri_smug.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bqosafyakp6kp" +path="res://.godot/imported/kiri_smug.png-3779d780d643bd959b80f9294c1515ce.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Core/UI/Images/icons/kiri_smug.png" +dest_files=["res://.godot/imported/kiri_smug.png-3779d780d643bd959b80f9294c1515ce.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Mods/MediaPipe/_tracker/Project/new_tracker.py b/Mods/MediaPipe/_tracker/Project/new_tracker.py index 4bb067a..e4a56b5 100644 --- a/Mods/MediaPipe/_tracker/Project/new_tracker.py +++ b/Mods/MediaPipe/_tracker/Project/new_tracker.py @@ -3,6 +3,11 @@ import mediapipe from mediapipe.tasks import python from mediapipe.tasks.python import vision +import os +# this has to be set before cv2 is imported +# https://github.com/opencv/opencv/issues/17687 +os.environ["OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS"] = "0" + import cv2 import time import json @@ -14,7 +19,6 @@ from kiri_math import lerp import socket -import os import sys import psutil @@ -797,6 +801,11 @@ def enumerate_camera_devices(): if sys.platform == "linux": capture_api_preference = cv2.CAP_V4L2 + # CAP_ANY provides a Direct Show(DSHOW) backend and a Media Foundation(MSMF) backend + # MSMF is more modern and DSHOW maybe removed in any future version of windows so filter by MSMF + if sys.platform == "win32": + 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 # /dev/v4l/by-id . @@ -812,9 +821,11 @@ def enumerate_camera_devices(): pass all_camera_data = [] - - for camera_info in enumerate_cameras(apiPreference=capture_api_preference): - + cameras = enumerate_cameras(apiPreference=capture_api_preference) + if sys.platform == "win32" and len(cameras) == 0: + capture_api_preference = cv2.CAP_DSHOW + cameras = enumerate_cameras(apiPreference=capture_api_preference) + for camera_info in cameras: camera_name = camera_info.name if re.match("video[0-9]+", camera_info.name): @@ -836,6 +847,27 @@ def enumerate_camera_devices(): "index" : camera_info.index } - all_camera_data.append(camera_data) + if sys.platform == "linux": + from linuxpy.video.device import Device, VideoCapture + + cap = cv2.VideoCapture(camera_info.index, capture_api_preference) + works = False + if cap.isOpened(): + ret, frame = cap.read() + if ret and frame is not None: + works = True + else: + with Device(camera_info.path) as camera: + try: + for frame in camera: + pass + except OSError as e: + if e.errno == 16: + works = True + cap.release() + if works: + all_camera_data.append(camera_data) + else: + all_camera_data.append(camera_data) return all_camera_data diff --git a/Mods/MediaPipe/_tracker/Project/requirements.txt b/Mods/MediaPipe/_tracker/Project/requirements.txt index 2160776..3374aef 100644 --- a/Mods/MediaPipe/_tracker/Project/requirements.txt +++ b/Mods/MediaPipe/_tracker/Project/requirements.txt @@ -2,4 +2,4 @@ mediapipe==0.10.14 psutil==6.0.0 cv2-enumerate-cameras==1.1.18.2 numpy==1.26.0 - +linuxpy==0.23.0; sys_platform == "linux" diff --git a/addons/KiriPythonRPCWrapper/platform_status.json b/addons/KiriPythonRPCWrapper/platform_status.json index f02968e..d73edb0 100644 --- a/addons/KiriPythonRPCWrapper/platform_status.json +++ b/addons/KiriPythonRPCWrapper/platform_status.json @@ -3,33 +3,33 @@ "Linux-arm64": { "complete_filename": "cpython-3.12.7+20241016-aarch64-unknown-linux-gnu-install_only_stripped.tar.gz", "download_url": "https://github.com/indygreg/python-build-standalone/releases/download/20241016/cpython-3.12.7%2B20241016-aarch64-unknown-linux-gnu-install_only_stripped.tar.gz", - "file_size": 17865102, + "file_size": 17865102.0, "sort": "cpython-00000003-00000012-00000007-20241016-aarch64-unknown-linux-gnu-install_only_stripped-tar-gz" }, "Linux-x86_64": { "complete_filename": "cpython-3.12.5+20240814-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz", "download_url": "https://github.com/indygreg/python-build-standalone/releases/download/20240814/cpython-3.12.5%2B20240814-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz", - "file_size": 21984711, + "file_size": 21984711.0, "sort": "cpython-00000003-00000012-00000005-20240814-x86_64-unknown-linux-gnu-install_only_stripped-tar-gz" }, "Windows-x86_64": { "complete_filename": "cpython-3.12.5+20240814-x86_64-pc-windows-msvc-shared-install_only_stripped.tar.gz", "download_url": "https://github.com/indygreg/python-build-standalone/releases/download/20240814/cpython-3.12.5%2B20240814-x86_64-pc-windows-msvc-shared-install_only_stripped.tar.gz", - "file_size": 23569213, + "file_size": 23569213.0, "sort": "cpython-00000003-00000012-00000005-20240814-x86_64-pc-windows-msvc-shared-install_only_stripped-tar-gz" }, - "macOS-x86_64": { - "complete_filename": "cpython-3.12.5+20240814-x86_64-apple-darwin-install_only_stripped.tar.gz", - "download_url": "https://github.com/indygreg/python-build-standalone/releases/download/20240814/cpython-3.12.5%2B20240814-x86_64-apple-darwin-install_only_stripped.tar.gz", - "file_size": 16564547, - "sort": "cpython-00000003-00000012-00000005-20240814-x86_64-apple-darwin-install_only_stripped-tar-gz" - }, "macOS-arm64": { "complete_filename": "cpython-3.12.5+20240814-aarch64-apple-darwin-install_only_stripped.tar.gz", "download_url": "https://github.com/indygreg/python-build-standalone/releases/download/20240814/cpython-3.12.5%2B20240814-aarch64-apple-darwin-install_only_stripped.tar.gz", - "file_size": 16223961, + "file_size": 16223961.0, "sort": "cpython-00000003-00000012-00000005-20240814-aarch64-apple-darwin-install_only_stripped-tar-gz" + }, + "macOS-x86_64": { + "complete_filename": "cpython-3.12.5+20240814-x86_64-apple-darwin-install_only_stripped.tar.gz", + "download_url": "https://github.com/indygreg/python-build-standalone/releases/download/20240814/cpython-3.12.5%2B20240814-x86_64-apple-darwin-install_only_stripped.tar.gz", + "file_size": 16564547.0, + "sort": "cpython-00000003-00000012-00000005-20240814-x86_64-apple-darwin-install_only_stripped-tar-gz" } }, - "requirements": "mediapipe==0.10.14\npsutil==6.0.0\ncv2-enumerate-cameras==1.1.18.2\nnumpy==1.26.0\n\n" -} + "requirements": "mediapipe==0.10.14\npsutil==6.0.0\ncv2-enumerate-cameras==1.1.18.2\nnumpy==1.26.0\nlinuxpy==0.23.0; sys_platform == \"linux\"\n" +} \ No newline at end of file