質問編集履歴

1

追加のエラー内容

2021/12/31 13:38

投稿

tennor-man
tennor-man

スコア1

test CHANGED
File without changes
test CHANGED
@@ -57,3 +57,85 @@
57
57
  ssh(iPhoneのショートカット機能)からエラーなく動作させたいのですが、
58
58
 
59
59
  対処方法を教えてください。
60
+
61
+
62
+
63
+
64
+
65
+ # ※追記
66
+
67
+ 下記を実行すると、Localでは問題なく動作するものの、ssh経由では以下のエラーを出力します。
68
+
69
+
70
+
71
+
72
+
73
+ ```ここに言語を入力
74
+
75
+ import sys
76
+
77
+ import cv2 as cv
78
+
79
+ print(sys.executable)
80
+
81
+
82
+
83
+ # create camera instance
84
+
85
+ cap = cv.VideoCapture(0)
86
+
87
+
88
+
89
+ try:
90
+
91
+ while True:
92
+
93
+ ret, frame = cap.read()
94
+
95
+ if frame is None:
96
+
97
+ print('--(!) No captured frame -- Break!')
98
+
99
+ break
100
+
101
+
102
+
103
+ cv.imshow('OpenCV monitor', frame)
104
+
105
+
106
+
107
+ if cv.waitKey(1) & 0xFF == ord('q'):
108
+
109
+ break
110
+
111
+
112
+
113
+ except KeyboardInterrupt: # except the program gets interrupted by Ctrl+C on the keyboard.
114
+
115
+ print("\nCamera Interrupt")
116
+
117
+
118
+
119
+ finally:
120
+
121
+ cap.release()
122
+
123
+ cv.destroyAllWindows()
124
+
125
+
126
+
127
+ ```
128
+
129
+
130
+
131
+ ・エラー内容
132
+
133
+  Unable to init server: Could not connect: 接続を拒否されました
134
+
135
+  Traceback (most recent call last):
136
+
137
+ File "~/openCVTest.py", line 18, in <module> cv.imshow('OpenCV monitor', frame)
138
+
139
+ cv2.error: OpenCV(4.5.5) ...
140
+
141
+ (-2:Unspecified error) Can't initialize GTK backend in function 'cvInitSystem'