''' frame_of_deep_blobs = { # initialize frame_of_deep_blobs 'blob_': [], 'params': { 'I': frame_of_blobs['I'], 'G': frame_of_blobs['G'], 'Dy': frame_of_blobs['Dy'], 'Dx': frame_of_blobs['Dx'], # deeper params are initialized when they are fetched }), } for blob in frame_of_blobs['blob_']: # evaluate recursive sub-clustering in each blob, via cluster_eval -> intra_fork if blob['Dert']['G'] > aveB: # +G blob directly calls intra_fork(comp_g), no immediate sub-clustering intra_fork(blob, aveF, aveC, aveB, ave, rng * 2 + 1, 1, fig=0, fa=0) # nI = 1: g elif -blob['Dert']['G'] > aveB: # -G blob, sub-clustering by -vg for rng+ eval cluster_eval(blob, aveF, aveC, aveB, ave, rng + 1, 2, fig=0, fa=0) # cluster by -g for rng+, idiomatic crit=2: not index frame_of_deep_blobs['blob_'].append(blob) frame_of_deep_blobs['params'][1:] += blob['params'][1:] # incorrect, for selected blob params only? ''' # DEBUG ------------------------------------------------------------------- from utils import map_frame cv2.imwrite("../images/blobs.bmp", map_frame(frame_of_blobs)) # END DEBUG --------------------------------------------------------------- end_time = time() - start_time print(end_time)
# ----------------------------------------------------------------------------- # Main if __name__ == '__main__': image = imread(image_path).astype(int) start_time = time() frame_of_blobs = image_to_blobs(image) ''' frame_of_blobs = [ # evaluate for deeper sub-clustering within each blob, recursively for blob in frame_of_blobs: if blob['Dert']['G'] > aveB: # +G blob, exclusive g- sub-clustering for der+ eval cluster_eval(blob, aveF, aveC, aveB, ave, rng * 2 + 1, 1, fig=0, fa=0) # cluster by g elif -blob['Dert']['G'] > aveB: # -G blob, exclusive m- sub-clustering for rng+ eval cluster_eval(blob, aveF, aveC, aveB, ave, rng + 1, 2, fig=0, fa=0) # cluster by m, defined in form_P ] ''' # DEBUG ------------------------------------------------------------------- if DEBUG: from utils import draw, map_frame draw("./../visualization/images/blobs", map_frame(frame_of_blobs)) # from intra_blob_test import intra_blob # intra_blob(frame_of_blobs[1]) # END DEBUG --------------------------------------------------------------- end_time = time() - start_time print(end_time)