1 # -*- coding: utf-8 -*-
14 # print "Error this program require two argment"
17 conf = ConfigParser.SafeConfigParser()
18 conf.read("./sr.conf")
19 echo_threshold = int(conf.get("analyze", "echo_threshold"))
20 unite_echo_threshold = int(conf.get("analyze", "unite_echo_threshold"))
21 compared_with_pixels = conf.get("analyze", "compared_with_pixels")
26 #filetime = "1306140505"
27 #argvs = ["-a", filetime]
28 #filename = filetime + ".png"
31 #img = Image.open(filename)
34 #8,16,25,33,41,49,58,66,74,82,90,99,107,115,123,132,140,148,156,165,173,181,189,197,206,214,222,230,239,247
36 def make_csv_a(filetime, strength_list, echo_threshold, unite_echo_threshold):
38 libhro.read_csv(strength_list, filetime)
39 analyze_return = libhro.analyze(strength_list, echo_threshold, unite_echo_threshold)
40 writetxt = open("./echo/" + filetime + '.echo', 'w')
41 writetxt.write(str(analyze_return)[1:-1])
44 def make_csv_c(filetime, strength_list, echo_threshold, unite_echo_threshold):
45 filename = argvs[2] + ".png"
47 img = Image.open("./monoPNG/" + filename[:])
48 strength_list = libhro.make_list(img)
49 libhro.write_csv(strength_list, filetime)
51 def make_csv_ac(filetime, strength_list, echo_threshold, unite_echo_threshold):
53 filename = argvs[2] + ".png"
54 img = Image.open("./monoPNG/" + filename[:])
55 strength_list = libhro.make_list(img)
56 libhro.write_csv(strength_list, filetime)
57 analyze_return = libhro.analyze(strength_list, echo_threshold, unite_echo_threshold)
58 writetxt = open("./echo/" + filetime + '.echo', 'w')
59 writetxt.write(str(analyze_return)[1:-1])
63 if argvs[1] == "-a":#エコーカウントのみ
64 libhro.make_csv("a", filetime, echo_threshold, unite_echo_threshold, compared_with_pixels)
67 libhro.read_csv(strength_list, filetime)
68 analyze_return = libhro.analyze(strength_list, echo_threshold, unite_echo_threshold)
69 writetxt = open("./echo/" + filetime + '.echo', 'w')
70 writetxt.write(str(analyze_return)[1:-1])
73 if argvs[1] == "-c":#CSVファイル作成のみ
74 libhro.make_csv("c", filetime, echo_threshold, unite_echo_threshold)
76 filename = argvs[2] + ".png"
78 img = Image.open("./monoPNG/" + filename[:])
79 strength_list = libhro.make_list(img)
80 libhro.write_csv(strength_list, filetime)
83 if argvs[1] == "-ac":#両方
84 libhro.make_csv("ac", filetime, echo_threshold, unite_echo_threshold, compared_with_pixels)
87 filename = argvs[2] + ".png"
88 img = Image.open("./monoPNG/" + filename[:])
89 strength_list = libhro.make_list(img)
90 libhro.write_csv(strength_list, filetime)
91 analyze_return = libhro.analyze(strength_list, echo_threshold, unite_echo_threshold)
92 writetxt = open("./echo/" + filetime + '.echo', 'w')
93 writetxt.write(str(analyze_return)[1:-1])
97 #strength_list = make_list()
98 #read_csv(strength_list, filetime)
100 #print len(strength_list)
101 #write_csv(strength_list, filetime)
102 #analyze_return = analyze(strength_list)