You are provided with images of people at meetings, gatherings, group photos etc.
Count the number of faces you can spot in each image.
There will be no more than faces in each of the images. Assume that half or more of each face will be visible.
Here are the first three images corresponding to the 3 sample test cases which are executed on hitting "run".
The first line of input will contain two integers, and , representing the number of rows and columns of image pixels, respectively.
A 2D grid of pixel values will be provided (in regular text format through STDIN) that represent the pixel-wise values from the images. The images were originally in JPG or PNG formats.
Each pixel will be represented by three comma separated values denoting the Blue, Green and Red components, respectively. The pixel values will be in the range to . There will be a space between consecutive pixels in the same row.
No input test case exceeds 15MB in size, most are within 5MB and many are less than 1MB. So you may gradually iterate on your solution to handle larger and more complex cases. Take care to account for very different kinds of faces!
Output a single integer, the number of faces spotted in the provided image.
This example is for explanation only. The real inputs will be larger than this and will contain rows and columns.