Spyderのアップデートが来たのでアップデートします。
だだそれだけ
なお、私はSpyderをAnaconda経由で入れました
アップデート方法
1「Anaconda Promptを起動」
2「Anaconda全体を更新」
このコマンドを入力します
conda update anaconda
3「Spyderを更新」
このコマンドを入力します
pip install --upgrade spyder
以上です。ありがとうございました。
おまけ
import cv2 import numpy as np import time import random #テキスト表示関数の宣言 def i_print(str1,x,y,size,color): cv2.putText(img, str1, (x, y), cv2.FONT_HERSHEY_SIMPLEX,size, color, size, cv2.LINE_AA) capture = cv2.VideoCapture(0)#ウェブカメラと通信を開始する(個々の番号でカメラが変わる) camera_opened = capture.isOpened() #変数宣言 stert=0 state=0 num = random.randint(0, 2) pat=["GUU","CHOKI","PAA"] while camera_opened:#カメラが起動したら ret, img = capture.read()#ウェブカメラから1フレームを読み込む #各画像処理 hsvim = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) lower = np.array([0, 48, 80], dtype = "uint8") upper = np.array([20, 255, 255], dtype = "uint8") skinRegionHSV = cv2.inRange(hsvim, lower, upper) blurred = cv2.blur(skinRegionHSV, (2,2)) ret,thresh = cv2.threshold(blurred,0,255,cv2.THRESH_BINARY) #輪郭線の取得 contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) contours = max(contours, key=lambda x: cv2.contourArea(x)) #輪郭線を描画 hull = cv2.convexHull(contours) cv2.drawContours(img, [hull], -1, (0, 255, 255), 2) #輪郭線を囲む長方形のサイズを取得 rect = cv2.minAreaRect(contours) (cx, cy), (width, height), angle = rect wariai=int(abs(width-height)) i_print(str(int(width))+','+str(int(height))+','+str(wariai),0,25,1,(255,0,0)) #現在の手の状態を判定 if wariai>100: state=1 elif height<300 and width<300: state=0 else : state=2 i_print(pat[state],0,50,1,(255,0,0)) #Sキーの押下を待機 if cv2.waitKey(33) ==ord('s'): stert=2 time_sta = time.time() time_end = time.time() #カウントダウン、勝負結果等の表示 if stert>=1: if time_end- time_sta >10: stert=0 i_print("Press S to start",50,250,2,(255,0,0)) if time_end- time_sta >4 and stert==1: i_print(str(pat[num]),250,150,2,(0,0,255)) if num==state: i_print("AIKO",200,250,3,(0,255,0)) elif state == 0 and num == 1 or state == 1 and num == 2 or state == 2 and num == 0: i_print("YOU WIN",100,250,3,(0,0,255)) else : i_print("YOU LOSE",100,250,3,(255,0,0)) elif time_end- time_sta >4: random.seed() num = random.randint(0, 2) stert=1 elif time_end- time_sta >1: i_print(str(4-int(time_end- time_sta)),250,250,5,(0,0,255)) else : i_print("START",100,250,5,(0,0,255)) else : i_print("Press S to start",50,250,2,(255,0,0)) i_print("Press ESC to close",0,475,1,(255,0,0)) #画面更新 cv2.imshow("KAMERA DE JYANKEN", img) #ESCキーで終了 if cv2.waitKey(33) ==27: break capture.release() cv2.destroyAllWindows()