Name that shape
Is your code smarter than a kindergartner?
Background
Widgets, Inc. makes plastic parts of different sizes. However, all of these parts have one
or more of five shapes: circle,
triangle, rectangle,
square, and
polygon. As these parts travel on a conveyor belt, a
black and white camera mounted above the belt takes pictures of these parts. Here are examples of some of the images taken by the camera,
shapes.zip. Widgets, Inc. currently uses a kindergartner to recognize the shape and pull an appropriate lever to guide the part into a bin. In an effort to modernize their operation (and avoid the use of child labor), Widgets, Inc. has hired you to automate the shape recognition task.
Identify the number of shapes in each image and the type for each shape.
Your part
Your task is to use the Algoritharium and create an algorithm for recognizing the shape(s) contained in each picture taken by the camera. You may make the following assumptions:
- Each image contains either one or two (at most) shapes.
- Only the five shapes, circle, triangle, rectangle, square, and polygon
as shown in the examples will be tested.
- The principal axes of each shape will be aligned with the X and Y axes. That is, the shape will not be rotated within the image.
- The color of the shape will be different from the color of the background.
- While the shape may appear anywhere in the image, the shape will be surrounded on all sides by at least one row/column of background pixels.
- The shapes will be of different sizes.
- Only three of the test set images will have two shapes.
Grading
Ten points for each of the ten images correctly identified as to quantity and
type of at least one shape in each using System.out.print statements. Minus
three points for each shape incorrectly identified.
For example, say the ten
images were evenly mixed with half having one shape and half having two shapes,
if all ten were correctly identified as to how many shapes were in each then
that is fifty points and if ten of the fifteen shapes were correctly identified
that is another fifty points, finially deduct fifteen points for the five shapes
misidentified for a total of 85.
Bonus points: 1 for each shape recolored
according their type: circle (yellow),
triangle (green), rectangle
(teal), square (blue), and
polygon (purple)