teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

追加のエラー内容

2021/12/31 13:38

投稿

tennor-man
tennor-man

スコア1

title CHANGED
File without changes
body CHANGED
@@ -27,4 +27,45 @@
27
27
 
28
28
  ### 実現させたいこと
29
29
  ssh(iPhoneのショートカット機能)からエラーなく動作させたいのですが、
30
- 対処方法を教えてください。
30
+ 対処方法を教えてください。
31
+
32
+
33
+ # ※追記
34
+ 下記を実行すると、Localでは問題なく動作するものの、ssh経由では以下のエラーを出力します。
35
+
36
+
37
+ ```ここに言語を入力
38
+ import sys
39
+ import cv2 as cv
40
+ print(sys.executable)
41
+
42
+ # create camera instance
43
+ cap = cv.VideoCapture(0)
44
+
45
+ try:
46
+ while True:
47
+ ret, frame = cap.read()
48
+ if frame is None:
49
+ print('--(!) No captured frame -- Break!')
50
+ break
51
+
52
+ cv.imshow('OpenCV monitor', frame)
53
+
54
+ if cv.waitKey(1) & 0xFF == ord('q'):
55
+ break
56
+
57
+ except KeyboardInterrupt: # except the program gets interrupted by Ctrl+C on the keyboard.
58
+ print("\nCamera Interrupt")
59
+
60
+ finally:
61
+ cap.release()
62
+ cv.destroyAllWindows()
63
+
64
+ ```
65
+
66
+ ・エラー内容
67
+  Unable to init server: Could not connect: 接続を拒否されました
68
+  Traceback (most recent call last):
69
+ File "~/openCVTest.py", line 18, in <module> cv.imshow('OpenCV monitor', frame)
70
+ cv2.error: OpenCV(4.5.5) ...
71
+ (-2:Unspecified error) Can't initialize GTK backend in function 'cvInitSystem'