# Seeing edges where there are no edges

The human eye is able to detect a square inside the square in the following two images, even though there are no obvious edges and no obvious local changes in the density of dots.

GPT4o believes to see a circle in the first image, Gemini a triangle. So they just guess.

I wonder which computer vision systems, namely CNNs, are able to see the square, and what's going on inside. How do they detect edges where there are no edges? Which local feature of the image gives rise to the virtual edges of the square?

This is a segment of the upper (pseudo-)edge of the square:

Side note: With identical textures (identical levels of order/disorder) the figure is perfectly camouflaged - you can only see it separated from the background when it moves. Watch out here.

• Just look for few rows and find the angle between adjacent sample row wise. You can do columnwise as well. Commented Jul 1 at 22:22
• @Creator: Angle between what? Commented Jul 2 at 7:25
• Angle betwee the lines connecting adjectents dots. It is not one angle, I mean you may consider angels within a area to decide. Commented Jul 2 at 19:41

The name for this image processing task is texture segmentation. It takes into account not only the color of areas, but repetitive surface features, and uses them to divide the image into areas.

I gave it a quick try using FSEG_py which implements the algorithm from Factorization-Based Texture Segmentation. The result is not a perfect mask, but a reasonable start for further processing with e.g. morphological operations:

• The segmented picture is fascinating. I wonder which histogram gave rise to it, and how it was calculated (pointwise?). Is it easy to grasp? Commented Jul 2 at 21:29
• @Hans-PeterStricker I'm a bit lost on the details of the spectral histogram algorithm, but adding some intermediate saves I got example result from input filter and example histogram channel. Many of the other channels are not as good for separation, so the algorithm then uses multi-dimensional clustering to classify the data points. This is just one approach to texture segmentation, there exist algorithms using e.g. neural networks also.
– jpa
Commented Jul 3 at 6:11

The perception pipeline is an interesting subject to study. One of my favorite lectures to teach (usually as part of an psychoacoustics course) is the one on illusions and I always sprinkle in lots of visual ones even though there are interesting auditory ones to discuss too. Illusions are a gateway into recognizing and getting guesses at what our perception pipeline might be doing and form conjectures from the observations.

Take your pseudo-edge. I personally do not "really" see this as an edge. However, your square does pop out at me as fairly clearly a square. One phenomenon that illusions illustrate in my mind is the notion that object/shape recognition is important.

The "presumption" of shape is strong. Consider this Kanisza figure:

Most people see a triangle shape, though we can argue if it's really there. Our brain favors seeing shapes from mere suggestive evidence. However examples like this certainly complicates the question. Is local edge detection the right fit for model human perception of shape boundaries?

Still the question of object recognition in noise has been studied, and certainly local de-noising is a strategy employed to improve recognition, for example:

Another interesting example is the James Dalmatian and its recognition:

• van Tonder, G. J., & Ejima, Y. (2000). Bottom–up clues in target finding: Why a Dalmatian may be mistaken for an elephant. Perception, 29(2), 149-157.
• Thanks, Georg, for the links to Kanisza and the Dalmatian which I both had in mind, too. The difference with both compared to my images is the degree of "realness" of the edges which is a bit higher in my images, isn't it? In both of your cases the object as a whole obviously comes from top-down (as an expectation you may develop or not), in my case at least a bit more strongly from bottom-up. Again, it's a matter of (measurable?) degree. Commented Jul 4 at 7:34

When you see people can "see" it means our vision system is trained to extract features which assist to understand the image.

In this context seeing the different patterns in the arrangement of the dots: Random vs. Organized.

If you'd train an object detector on such train set it will be able to locate the squares.
Basically the training will adapt its feature extraction layers to extract the correct features.
In this case they will be more about the angles and the effect and response to horizontal and vertical filters.

If you have a script to generate such images, it will be no more then few minutes of training to solve this in my opinion.

• So there will be local feature detectors for "random" and "organized", and edge detectors that react on abrupt changes of this feature - instead of abrupt changes in luminosity or color? Commented Jul 2 at 7:27
• Considering that such images also for humans are rather rare "in the wild", it's astonishing that they developed such feature detectors - or is it a "distributed feature" possibly? Commented Jul 2 at 7:32
• @Hans-PeterStricker, Indeed. While DL models can rival human vision in many tasks, the holy grail is learning from few samples. This is still where human excel much more than the current models.
– Royi
Commented Jul 2 at 9:42
• @Hans-PeterStricker Yes. Commented Jul 2 at 12:20
• @Royi Humans learn from extraordinarily many samples - everything we can perceive as babies. That's why a lot of baby's toys are just generating new stimuli not otherwise found in the environment. With all this background knowledge, as adults, human adults can then "fine-tune" on new patterns with relatively few samples. Commented Jul 2 at 12:21