# title ![](https://i.imgur.com/ByTpkW5.jpg) [google](/OAj9LOImRhCu4A10MhfE2g) # quote 1.qew 2.weqwq 3.dsajidosaj # List hi a dsadsa *body* **ewqe** <font color= 'red'>body</font> ``` weqweqw ``` ```python = # -*- coding: utf-8 -*- # -*- coding: utf-8 -*- """ Created on Mon Dec 13 13:51:44 2021 @author: user """ import cv2 import mediapipe as mp import time import random as rd import time as t md = mp.solutions.pose pose= md.Pose() mpDraw = mp.solutions.drawing_utils cap = cv2.VideoCapture(0 , cv2.CAP_DSHOW) cap.set(3, 1024) cap.set(4, 768) cx1,cy1=0,0 r= 30 is1 = False atime = t.time() ctime = t.time() link = None rlink = None def isinside(cx,cy,r,x,y): dis = ((cx - x)**2 + (cy - y)**2) ** 0.5 if dis <= r: return True else: return False while True: success, img = cap.read() imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) results = pose.process(imgRGB) img = cv2.flip(img, 1) if results.pose_landmarks: mpDraw.draw_landmarks(img, results.pose_landmarks,md.POSE_CONNECTIONS) llink = results.pose_landmarks.landmark[19] x,y = llink.x ,llink.y h,w = img.shape x = int(x* w) y = int(y*h) def isinside(cx,cy,r,x,y): is1 = False nose = results.pose_landmarks.landmark[0] # 取得 x 及 y x, y = nose.x, nose.y # 取得影像的寬,高,chanel #h = 高 , w = 寬 , _ = chanel,表示_代表不在意 h,w,_ = img.shape # mediapipe 所取得的 x and y 是正規化過的 # 底下的程式碼將其反正規化,這樣才得到真正的座標 cx=int(x*w) cy=int(y*h) # 畫圓 cv2.circle(img, (cx,cy), 10, (0,0,255), -1) if is1 == False: cx1 = rd.randint(0, 100) cy1 = rd.randint(0, 100) is1 = True atime = t.time() cv2.circle(img, (cx1,cy1),r, (125,125,0) , -1) else: cv2.circle(img, (cx1,cy1),r, (125,125,0) , -1) ctime = t.time() if ctime - atime >= 2: is1 = False cv2.imshow('image', img) if cv2.waitKey(5) == ord('q'): break cap.release() cv2.destroyAllWindows() ``` $x^2 +y_{ij}^3 = 6\times 18$ ****