We are analyzing an array of pixels to test a system's ability to reason. Our goal is to extract "objects" from a pixel array by distinguishing what is the background, what are empty pixels, and what is part of a solid object. The following describes the algorithm to follow.
We are using a coordinate system that is composed of the following:
Pixel grids must be rectangular or square in their arrangement, as they are meant to represent a screen. Pixels can be one of ten values: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9.
Pixels with a value of 0 are considered empty.
All other pixel values represent either the background or an object. An object is represented by any pixel whose value is between 1 and 9. The background can be any value between 1 and 9.
Pixels are said to be "adjacent"(or in other words, next to each other) if they are vertically, horizontally or diagonally next to each other. Below are examples of how pixels can be "adjacent".
Being a colored pixel and having a single colored pixel to your left or to your right means you are "adjacent" to that pixel.
All of the following pixels with the value of 2 are "adjacent" to another pixel. There are two example pixel grids below. Study them carefully.
[0, 0, 2, 2, 2, 0, 0] -> This pixel list has seven(7) pixels. In this pixel list, the three(3) middle pixels are "adjacent" to each other. We count them like the following:
[0(empty), 0(empty), 2(not isolated due to pixel on the right also being colored; Count: one), 2(Count: two), 2(not isolated due to pixel on the left also being colored; Count: three), 0(empty), 0(empty)]
We find that the three(3) middle pixels are "adjacent".
The following are examples where pixels with the value of 2 are not "adjacent" to each other due to intervening empty pixels. There are two example pixel grids below. Study them carefully.
[2, 0, 2, 0, 2, 0, 2, 0, 2] -> This pixel list has nine(9) pixels. In this pixel list, none of the pixels are "adjacent". We count them like the following:
[0, 2, 0, 2, 0, 2, 0, 2, 0] -> This pixel list has nine(9) pixels. In this pixel list, none of the pixels are "adjacent". We count them like the following:
If a pixel is a color between 1 and 9, but it is surrounded by empty pixels, it is part of the background.
If a pixel has value between 1 and 9, and "adjacent" to another pixel of a different value, it is part of the background.
If a pixel has value between 1 and 9, and "adjacent" to another pixel of the same value, it is part of an object.
The following is how to identify the object we need to extract.
We are looking for a letter-resembling object. You can look for "M", "C", "D", "T", etc. The letter-resembling object will be one pixel thick and made of multiple adjoined pixel lines. In this case, the letter "I" is disqualified because our object is made of at least two pixel lines.
Remember, in the following test, we are looking for a continuous shape that forms what appears to be a letter. Please adhere to the following guidelines.
You must analyze both rows and columns.
Look for miscounted pixels using the "Count: " method displayed in the algorithm.
Do not adjoin isolated pixels.
Colored pixels in separate rows that are not directly "adjacent" to the continuous pixel lines should not form part of the object we extract.
Before deciding on the bounding box and final pixel grid, COUNT the pixels that the object is composed of EXPLICITLY.
Please solve the pixel grid below. Take a deep breath. Please think carefully.
Column 4: This column contains all the potential vertical line pixels. [8(Count: 1), 0, 8(Count: 2), 8(Count: 3), 8(Count: 4), 8(Count: 5), 8(Count: 6), 0, 8(Count: 7), 0]. These pixels are adjacent and form a vertical line.
Column 5-10: All empty pixels.
Identifying the Object and Bounding Box:
We have a horizontal line of seven '8' pixels in row 3 and a vertical line of seven '8' pixels in column 4. These lines intersect and are adjacent, forming the letter 'T'.
The object is the letter 'T', formed by 13 adjacent pixels. The bounding box encompasses this letter within the original pixel grid. We have successfully extracted the object based on the provided algorithm.