testData.py 795 B

123456789101112131415161718192021
  1. import os
  2. import numpy as np
  3. import cv2
  4. import csv
  5. dir = "../data1/"
  6. for image in os.listdir(dir):
  7. if image.endswith("jpg") or image.endswith("JPG"):
  8. if os.path.isfile(dir+image+".csv"):
  9. with open(dir+image+ ".csv", 'r') as csvfile:
  10. spamwriter = csv.reader(csvfile, delimiter=' ',
  11. quotechar='|', quoting=csv.QUOTE_MINIMAL)
  12. img = cv2.imread(dir + image)
  13. no = 0
  14. for row in spamwriter:
  15. no+=1
  16. print (row)
  17. img = cv2.circle(img, (int(float(row[0])), int(float(row[1]))), 2,(255-no*60,no*60,0),90)
  18. img = cv2.resize(img, (300,300))
  19. cv2.imshow("a",img)
  20. cv2.waitKey(0)