From ae5bf0c208f1f36f425ec224a7e5039c33849f89 Mon Sep 17 00:00:00 2001 From: ykcheungab Date: Mon, 14 Sep 2026 10:44:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=AD=E5=BC=80=E8=BF=9E=E6=8E=A5=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E5=9B=A0=E6=97=A0=E5=A4=B4=20OpenCV=20=E6=8A=9B?= =?UTF-8?q?=E9=94=99=20-=20What:=20Sensor.disconnect()=20=E9=87=8C?= =?UTF-8?q?=E7=9A=84=20cv2.destroyAllWindows()=20=E5=8C=85=E4=B8=8A=20try/?= =?UTF-8?q?except=20cv2.error=EF=BC=9A=E6=97=A0=E5=A4=B4=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=EF=BC=88opencv-python-headless=EF=BC=89=E6=B2=A1=E6=9C=89=20hi?= =?UTF-8?q?ghgui=EF=BC=8CdestroyAllWindows=20=E4=BC=9A=E6=8A=9B=20"The=20f?= =?UTF-8?q?unction=20is=20not=20implemented"=EF=BC=8C=E6=AD=A4=E5=89=8D?= =?UTF-8?q?=E4=BC=9A=E8=AE=A9=20finally=20=E9=87=8C=20disconnect()=20?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E7=94=A8=E6=96=B9=EF=BC=88=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E3=80=81=E9=87=87=E9=9B=86=E9=80=80=E5=87=BA=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=EF=BC=89=E6=8B=BF=E5=88=B0=E4=B8=80=E4=B8=AA=E4=B8=8E=E4=BC=A0?= =?UTF-8?q?=E6=84=9F=E5=99=A8=E6=97=A0=E5=85=B3=E7=9A=84=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E3=80=82=20-=20Why:=20=E8=B7=91=20SDK=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=97=B6=E5=8F=91=E7=8E=B0=20tests/test=5Fcalibration.py::test?= =?UTF-8?q?=5Fsensor=5Fcal=5Fpath=5Fv2=5Fapplies=5Fto=5Fread=5Finfo=20?= =?UTF-8?q?=E4=B8=8E=20test=5Fset=5Fcalibration=5Fswaps=5Fcurve=20?= =?UTF-8?q?=E5=9C=A8=E6=9C=AC=E6=9C=BA=EF=BC=88cv2=204.14.0=20headless?= =?UTF-8?q?=EF=BC=89=E7=A8=B3=E5=AE=9A=E5=A4=B1=E8=B4=A5=EF=BC=8C=E6=96=AD?= =?UTF-8?q?=E8=A8=80=E6=9C=AC=E8=BA=AB=E9=83=BD=E8=BF=87=E4=BA=86=EF=BC=8C?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E5=9C=A8=20finally=20=E7=9A=84=20disconnect(?= =?UTF-8?q?)=20=E7=AC=AC=201098=20=E8=A1=8C=EF=BC=9B=E8=BF=99=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E6=BB=A4=E6=B3=A2=E6=94=B9=E5=8A=A8=E5=BC=95=E5=85=A5?= =?UTF-8?q?=E7=9A=84=EF=BC=8C=E4=BD=86=E4=BC=9A=E4=B8=80=E7=9B=B4=E6=B1=A1?= =?UTF-8?q?=E6=9F=93=E6=AF=8F=E6=AC=A1=E9=AA=8C=E8=AF=81=EF=BC=8C=E4=B8=94?= =?UTF-8?q?=20SDK=20=E6=98=8E=E7=A1=AE=E6=94=AF=E6=8C=81=E6=97=A0=E5=A4=B4?= =?UTF-8?q?/CI=20=E4=BD=BF=E7=94=A8=EF=BC=88backend=3D"cpu"=E3=80=81extern?= =?UTF-8?q?al-frame=20=E6=A8=A1=E5=BC=8F=EF=BC=89=E3=80=82=20-=20Verificat?= =?UTF-8?q?ion:=20=E4=BF=AE=E5=89=8D=E8=AF=A5=E6=A8=A1=E5=9D=97=207=20fail?= =?UTF-8?q?ed=20/=2013=20passed=EF=BC=88=E5=90=AB=E4=B8=8A=E8=BF=B0?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E6=97=A2=E6=9C=89=E6=B5=8B=E8=AF=95=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=90=8E=2020=20passed=EF=BC=9BSDK=20?= =?UTF-8?q?=E5=85=A8=E9=87=8F=20335=20passed=20/=2015=20skipped=EF=BC=88?= =?UTF-8?q?=E5=94=AF=E4=B8=80=E5=A4=B1=E8=B4=A5=E4=B8=BA=E9=9C=80=E8=A6=81?= =?UTF-8?q?=201200=20=E5=B8=A7=E8=80=8C=20data/sample/s1=5F480p.mp4=20?= =?UTF-8?q?=E5=8F=AA=E6=9C=89=20577=20=E5=B8=A7=E7=9A=84=20longrun=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=89=E3=80=82=20-=20Not=20in=20this=20ch?= =?UTF-8?q?ange:=20=E6=9C=AA=E6=94=B9=20disconnect()=20=E7=9A=84=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E5=88=86=E6=94=AF=EF=BC=9B=E6=9C=AA=E5=BC=95=E5=85=A5?= =?UTF-8?q?=20highgui=20=E4=BE=9D=E8=B5=96=E6=8E=A2=E6=B5=8B=EF=BC=8C?= =?UTF-8?q?=E5=8F=AA=E5=9C=A8=E7=9C=9F=E6=AD=A3=E8=B0=83=E7=94=A8=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E6=97=B6=E5=BF=BD=E7=95=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/orisys/sensor.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/orisys/sensor.py b/src/orisys/sensor.py index 28751cd..452756e 100644 --- a/src/orisys/sensor.py +++ b/src/orisys/sensor.py @@ -1095,7 +1095,14 @@ class Sensor: # self.cap = None # if self.verbose: # print("Sensor disconnected.") - cv2.destroyAllWindows() + try: + cv2.destroyAllWindows() + except cv2.error: + # A headless OpenCV build (``opencv-python-headless``) has no highgui, + # so there is nothing to close. Failing here would leave the rest of + # the shutdown — and every caller that disconnects in a ``finally`` — + # reporting an error that says nothing about the sensor. + pass # ========================================================================= # Public API - Configuration & Calibration