December 2018
Intermediate to advanced
182 pages
4h 21m
English
Let's look at our next function to get the matching characters:
def getmatchingchars(char_cands): char_list = [] for char_cand in char_cands: ch_matches = [] \n", for matching_candidate in char_cands: if matching_candidate == char_cand: continue chardistance = np.sqrt((abs(char_cand.x_cent - matching_candidate.x_cent) ** 2) + (abs(char_cand.y_cent - matching_candidate.y_cent)**2)) x = float(abs(char_cand.x_cent - matching_candidate.x_cent)) y = float(abs(char_cand.y_cent - matching_candidate.y_cent)) angle = np.rad2deg(np.arctan(y/x) if x != 0.0 else np.pi/2) deltaarea = float(abs(matching_candidate.rect_area - char_cand.rect_area))\ / float(char_cand.rect_area) deltawidth = float(abs(matching_candidate.rect_w-char_cand.rect_w))\ ...
Read now
Unlock full access