This commit is contained in:
Colombo 2019-12-11 22:34:22 +04:00
parent d4745b5cf8
commit c866448645

View file

@ -916,38 +916,6 @@ def sort_by_absdiff(input_path):
img_list = [ (image_paths[x],) for x in sorted] img_list = [ (image_paths[x],) for x in sorted]
return img_list, [] return img_list, []
"""
img_list_len = len(img_list)
for i in io.progress_bar_generator ( range(img_list_len-1), "Sorting" ):
a = []
i_1 = img_list[i][1]
for j in range(i+1, img_list_len):
a.append ( [ j, np.linalg.norm(i_1-img_list[j][1]) ] )
x = sorted(a, key=operator.itemgetter(1) )[0][0]
saved = img_list[i+1]
img_list[i+1] = img_list[x]
img_list[x] = saved
q = np.array ( [ x[1] for x in img_list ] )
for i in io.progress_bar_generator ( range(img_list_len-1), "Sorting" ):
a = np.linalg.norm( q[i] - q[i+1:], axis=1 )
a = i+1+np.argmin(a)
saved = img_list[i+1]
img_list[i+1] = img_list[a]
img_list[a] = saved
saved = q[i+1]
q[i+1] = q[a]
q[a] = saved
"""
def final_process(input_path, img_list, trash_img_list): def final_process(input_path, img_list, trash_img_list):
if len(trash_img_list) != 0: if len(trash_img_list) != 0:
@ -988,8 +956,6 @@ def final_process(input_path, img_list, trash_img_list):
except: except:
io.log_info ('fail to rename %s' % (src.name) ) io.log_info ('fail to rename %s' % (src.name) )
def main (input_path, sort_by_method): def main (input_path, sort_by_method):
input_path = Path(input_path) input_path = Path(input_path)
sort_by_method = sort_by_method.lower() sort_by_method = sort_by_method.lower()