Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for each circle i:
- neighbour_list = [] #init list of neighbours
- for each circle j: #for each neighbour
- d = distance(i,j)) #compute distance
- if d < range: # if its within range
- neighbour_list.append(j) #add neighbour to the list
- neighbour_list.append(i) # adding itself to the list
- # now we go through the list of neighbours including circle i and find out the largest circle
- for k in neighbour_list:
- m = 0 # temp value for comparison
- largest_circle = circle_type # stores circle object / id / coordinates
- if area(k) > m: #if area of circle k is larger than what's stored in m
- m = area(k) #update m
- largest_circle = area(k) #set largest (so far) circle k
- # now we delete all circles from image except largest_circle
- for x in neighbour_list:
- if x != largest_circle:
- delete(x) #deletes circle from image
- return largest_circle # optional
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement