Exemplo n.º 1
0
def newimg(img):  #Image will be taken for Deskewing
    newim = Deskew.deskew(img)  #Deskew the image
    #print(newim)
    data = MyClust.get_all_points(
        newim)  #Gives all points according to threshold
    print("Shape:", data.shape[0])
    if (data.shape[0] < 300): print("Continue")
    else:
        print("Nice try !!!!")
        return
    #############      CLUSTERING       #################
    lm = MyClust.Get_Clusters(
        data,
        num_clusters)  #Data of all points will be clustered into some points
    lm2 = np.array(Euclid.fun1(lm,
                               num_clusters))  #Distance array of all clusters
    #print(lm2)
    lm2 = Ham.Shortest_path_way(
        lm2, num_clusters)  #Order of the path it needed to travel
    #print(lm2)
    lm2 = np.array(lm2[0][:-1], dtype=np.int64)
    #print(lm2)
    mm = Ham.path_order(
        lm2, lm,
        num_clusters)  #After sorting of the landmarks,path has been defined
    #print(mm)
    return (mm)  #Returning path to comp2
Exemplo n.º 2
0
def newimg(img_no):
    
    newim = Deskew.deskew(test_images[img_no])
    #print(newim)
    data= MyClust.get_all_points(newim)
    #############      CLUSTERING       #################     
    lm= MyClust.Get_Cluster(data,num_clusters)
    lm2=  np.array(Euclid.fun1(lm,num_clusters))
    #print(lm2)   
    lm2= Ham.fun3(lm2,num_clusters)
    lm2= np.array(lm2[0],dtype= np.int64)
    order= lm2[:-1]
    mm= Ham.path_order(order,lm,num_clusters)
    #print(mm)

    return(mm)