From 1ecbc9edba1845568b6fd4161d337eb83b06b6f5 Mon Sep 17 00:00:00 2001 From: q Date: Fri, 23 May 2014 08:57:22 +0300 Subject: [PATCH] ratio diff --- image_list.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/image_list.py b/image_list.py index 21beeb2..6e42b47 100755 --- a/image_list.py +++ b/image_list.py @@ -402,7 +402,7 @@ def find_fingerprint_nearest(opts): colors=get_colors(cmp)[0] db1.execute("SELECT file,fingerprint,sharpness,width,height,R,G,B FROM list WHERE sharpness > 0 ORDER BY file") - this=['',thr,0,0,0,0] + this=['',thr,0,0,0,0,0] hit1=None for i,hit1 in enumerate(db1): if hit1[0] == cmp: @@ -415,6 +415,7 @@ def find_fingerprint_nearest(opts): this[3]=int(hit1[3]) this[4]=int(hit1[4]) this[5]=abs( hit1[5] - colors[0] )+abs( hit1[6] - colors[1] )+abs( hit1[7] - colors[2] ) + this[6]= (this[3]/float(this[4])) / (float(dims[0])/float(dims[1])) if hit1==None: print("No measurements found") sys.exit(1) @@ -422,9 +423,9 @@ def find_fingerprint_nearest(opts): print("No similar images for "+cmp+", up to threshold "+str(thr)) return file_len=str(max(len(cmp), len(this[0]))) - print( ('{: <'+file_len+'} {: >4} {: >4} {: >4} {: ^5}x{: ^5}').format("File","Diff","CDel","Shrp","Wth","Hgt")) + print( ('{: <'+file_len+'} {: >4} {: >4} {: >4} {: ^5}x{: ^5}').format("File","Diff","CD","RoR","Shrp","Wth","Hgt")) print( ('{: <'+file_len+'} {: >4} {: >4} {: >4} {: >5}x{: >5}').format(cmp,"","","%.1f" % sp,dims[0],dims[1])) - print( ('{: <'+file_len+'} {: >4} {: >4} {: >4} {: >5}x{: >5}').format(this[0], this[1],"%.2f"%this[5], "%.1f" % this[2],this[3], this[4])) + print( ('{: <'+file_len+'} {: >4} {: >4} {: >4} {: >4} {: >5}x{: >5}').format(this[0], this[1],"%.2f"%this[5],"%.3f"%this[6], "%.1f" % this[2],this[3], this[4])) if opts.viewer: subprocess.call(opts.viewer.replace('%f', " ".join((cmp,this[0]))), stderr=subprocess.STDOUT, shell=True)