Solution for the task “Rhinozelfant” of the 35th Federal Computer Science Competition, in which I took part in 2018.
A rhinoceros elephant has been found in the primeval forest of Informatia. Researchers are thrilled: for the first time in centuries, a previously unknown large animal has been discovered. The question arises as to why these animals have remained hidden for so long. Apparently they have a particularly good camouflage mechanism.
After the first rhinoceros elephants were brought to a zoo, the animal keepers discovered that they can adapt the colour of their skin to any environment, similar to chameleons. When a rhinoceros elephant notices that it is being observed, each of its skin scales takes on the colour of the environment on the opposite side of its body to the observer. This makes it virtually “transparent” to the observer.
With modern digital cameras, however, it is possible to recognise rhinoceros elephants: If the resolution is just high enough, several adjacent pixels represent each skin scale. Because all these pixels depict the same scale, they have exactly the same colour. This makes it possible to determine which pixels in an image possibly represent a rhinoceros elephant.
Numerous photos from the rhinoceros elephant forest should now be checked to see whether a rhinoceros elephant is depicted on them.
Create a program that colours those pixels of an image white that could belong to a rhinoceros elephant. Some pictures are provided below. Which ones show a rhinoceros elephant?