def already_processed_neighbours(point, higher_intensity): if point.intensity < higher_intensity[-1].intensity: higher_intensity = filter( lambda neighbour: neighbour.intensity >= point.intensity, universe) return point.neighbours(higher_intensity) logging.info("Preprocessing step") num_points = len(universe) i = 0 for point in universe: i += 1 set1[point] = MSER.DisjointSet(point) set2[point] = MSER.DisjointSet(point) nodes[point] = MSER.ComponentTree(point.intensity) subtreeRoot[point] = point i = 0 print "Universe bomb" for point in universe: i += 1 current_canonical = set1[point].find() current_node = set2[subtreeRoot[current_canonical.data]].find() # print "Looking at ", nodes[current_node.data] # if point.row == 22 and point.col == 19: # print "Looking at special point" for neighbour in already_processed_neighbours(point, higher_intensity): # if point.row == 22 and point.col == 19: # print "Neighbour of special pt ", neighbour, " ", neighbour.intensity if neighbour.intensity >= point.intensity: neighbour_canonical = set1[neighbour].find()