According to Wikipedia, image processing is any form of signal processing for
which the input is an image, such as photographs or frames of video; the output of image processing can be either an image or a set of characteristics or parameters related to the image. Most image-processing techniques involve treating the image as a two-dimensional signal and applying standard signal-processing techniques to it.
The task you are facing here is a relatively easy one (compared to our general
conception of image processing!). Given a black-and-white image of size R * C with some digits (and possibly other shapes) on it, your program needs to figure out the digits written on the image. Specifically, the digits drawn on the graph will adhere to the following rules:
1) Digits are drawn with a series of strokes. A stroke can be regarded as a
rectangle of any size on the image, and its edges will always be parallel to
either x-axis or y-axis. The number of strokes required to draw each digit will
be exactly as follows:
Refer to Figure 2 if you’re unclear about how the digits are drawn.
2) Although the width of strokes used to draw a digit might be different, the outer shapes of digits will strictly follow those specified in Figure 2.
3) In order for a digit to be recognizable, all parts (strokes and joints) presented in the graph below must also be clearly distinguishable in the image.
(Refer to the last sample test case if you are unsure about this requirement;
in that test case, when the middle stroke of 2 is omitted, the number should
not be considered as recognizable.)
4) You may assume that the image is not rotated, and there is no noise in the input.
Please output the sum of digits recognizable in the graph. In the case that no
characters is recognizable, please output 0 instead.