Note: this is my first post here.
The Challenge
The challenge is to count the number of chocolate chips in a cookie. A cookie in this case is a circle with dots (the chips) in it. Given any square cartoon image of this cookie, you are to write a bot that counts and outputs the number of chocolate chips.
Rules
- Has to take in an image type of png.
- It has to be able to take in any file size, as long as it is square.
- It has to be able to handle both color and B&W images.
- Output can be in any human-understandable form.
- The circle will be filled with color and will have an outline.
- Chips will all be the same size and color.
- There is only one cookie in the image
- Chocolate chips may be irregularly spaced, but are perfect circles.
- You can use a library.
- There is nothing in the image except the cookie and the chocolate chips. -All other cookies will look like the example images.
This is code-golf; the shortest code gets accepted.
Examples
Cookie 1 => 8
or 1000
(binary)
Cookie 2 => 8
or 1000
(binary)
Cookie 3 => 10
or 1010
(binary)
Cookie 4 => 7
or 0111
(binary)