Challenge: Return number of objects in an image using Python's pillow library (PIL) -
challenge: possible create method count number of objects contained in image using pil library? image gray scale, instance plain white background 3 black circles return integer 3. have been messing around imagefilter quite bit can't seem find i'm looking for. know can done using other libraries unfortunately not have access them.
ok, have currently:
def get_num_objects(im_1): count_objects = 0 edges = im_1.filter(imagefilter.find_edges) edge_data = edges.load() # need way count edges edge in edge_data: count_objects += 1 return count_objects
i realize objects may have multiple edges , trying iterate through edge_data return error. i'm not finding in docs looks work i'm trying achieve. thanks.
yes possible. there no built-in function want. you'll have implement yourself.
Comments
Post a Comment