Introduction - If you have any usage issues, please Google them yourself
B is doing a research on image understanding, and her goal is to identify the outline in the image. At this stage, she wants to be able to identify the square. The image is represented by a matrix. Each element of the matrix corresponds to a pixel in the image, with a value of 0 or 1, 0 for the background and 1 for the foreground. The squares to be searched must meet the line width of a single pixel, and the size is at least 2x2. She wants you to help her find the number of two types of squares in the image that meet the following conditions:
The edge of a square is parallel to the edge of a matrix.
The edge of a square is parallel to the diagonal of the matrix;