Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. import cv2
  2.  
  3.  
  4. data_file = "Dataset"
  5. file = open("./"+data_file+"/input_seg.txt", 'r')
  6.  
  7. # Enter your name
  8. out_file = open("./results/almat_kenen_KBTU.txt", 'w')
  9.  
  10. for line in file:
  11.     if ".jpg" in line:
  12.         imgPath = "./"+data_file+"/" + line[:-1]
  13.         img = cv2.imread(imgPath)
  14.         line1 = line
  15.     else:
  16.         cords = line[:-1].split(" ")
  17.         y1 = int(cords[0])
  18.         x1 = int(cords[1])
  19.         y2 = int(cords[2])
  20.         x2 = int(cords[3])
  21.  
  22.         lp_img = img[y1:y2, x1:x2]
  23.         cv2.imshow("LP img", lp_img)
  24.         cv2.waitKey(0)
  25.  
  26.  
  27.         out_file.write(line1)
  28.         out_file.write(line)
  29.         out_file.write(out)
  30.         #out_file.write("Here import cv2
  31. import tools as tl
  32. import numpy as np
  33.  
  34. data_file = "Dataset"
  35. file = open("./"+data_file+"/input_seg.txt", 'r')
  36.  
  37. # Enter your name
  38. out_file = open("./results/Artur_Abdalimov_KBTU.txt", 'w')
  39.  
  40. for line in file:
  41.     if ".jpg" in line:
  42.         imgPath = "./"+data_file+"/" + line[:-1]
  43.         img = cv2.imread(imgPath)
  44.         line1 = line
  45.     else:
  46.         cords = line[:-1].split(" ")
  47.         y1 = int(cords[0])
  48.         x1 = int(cords[1])
  49.         y2 = int(cords[2])
  50.         x2 = int(cords[3])
  51.  
  52.         ar = [0, 0.12, 0.23, 0.34, 0.43, 0.55, 0.64, 0.74, 0.77, 0.87, 1.0]
  53.         ans = []
  54.         ln = x2 - x1
  55.  
  56.         for i in range(len(ar)):
  57.           cur = x1 + ln * ar[i]
  58.           ans.append(cur)
  59.  
  60.         out = " ".join(str(x) for x in ans)
  61.         out_file.write(line1)
  62.         out_file.write(line)
  63.         out_file.write(out)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement