hamaXD

Signal&Image1_62 after midterm #6 : DoctempHW9

Oct 10th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. form matplotlib impoer pyplot as plot
  2. import cv2
  3. import os
  4. import
  5.  
  6.  
  7.  
  8. form collections import deque
  9. from imutils.Video import VideoStream
  10.  
  11. line 6 pts =deque(maxlen=100) สามารถวาดรูปได้ 1000 จุด ยาว 10010 จุก ต้องประกาศตัวนี้ก่อน
  12.  
  13. import with old code
  14. line 24
  15. blurred = cv2.GaussianBlur(frame,(11,11),0) //ทำ filter
  16. hsv =
  17.  
  18.  
  19. line find max max(contours , key=cv2.contourArea ) หาค่า มากที่สุด ของ contor
  20. line 44 M = cv2.moment(c) หาโมเมนของวัตถุ 0 หาค่าเฉลี่ย 1 ค่าเบี่ยงเบน  2   //หาจุดกึงกลาง
  21. center = (int(M["m10"]/M["m00"]) , int(M["m01"]/M["m00"]) )
  22.  
  23.  
  24. line 46
  25. cv2.minEnclosingCircle(c) สร้างวงกลมขึ้นมา
  26.  
  27. line 48 - 58 คือการวาดรูป
  28. line 55 - 60 วาดเส้น
  29. line 55 เป็นการเก็บจุดเพื่อลากเส้น
  30.  
  31.  
  32. line 55 เอาค่า center มาเก็บใน pts
Add Comment
Please, Sign In to add comment