Categories
Computer Vision

Unlocking the Depths: The Magic of Stereograms Through Computer Vision

Stereograms are a fascinating visual phenomenon that has captivated audiences for centuries. Although their popularity has waned over time, the underlying principles continue to intrigue. Originally, stereograms were designed to create an illusion of depth from a flat image, effectively tricking the brain into seeing a three-dimensional scene. This optical illusion is achieved by manipulating the viewer’s depth perception through subtle visual cues. As we delve into the possibilities offered by computer vision technology, we can appreciate the unique applications of stereograms across various fields. Their ability to transform two-dimensional visuals into three-dimensional experiences highlights their potential as a tool for enhancing visual perception and creating engaging imagery.

Here is an example of a stereogram image to give you an idea of how a stereogram based on an original image might appear. This sample stereogram provides a visual representation of how the 3D effect is achieved using depth maps and patterns.

Original Image ( Airplane )
Stereogram image of the original image ( Airplane )

Give a moment or two to see the 3D image of an animated version of an airplane in the stereogram image. This is how stereogram image looks like.

We provided three images: one featuring a black hole, another depicting a camel, and the third showcasing a coke glass bottle. We selected these images for various reasons. Firstly, the black hole image was chosen to challenge viewers and provide a unique experience. We thought it would be really unique to see a black hole in 3D, mainly because we can’t forever wait on NASA to show us a 3D rendering of a black hole. So we decided to take matters into our own hands. Secondly, we utilized DALLE to generate an image of a camel in a desert at sunset, which we found particularly striking and engaging. This choice was made to create a scenic and captivating depiction of a camel in its natural habitat. The third image is a straightforward depiction of a bottle. Our curiosity led us to explore how a bottle would appear in a stereographic 3D image. So we have implemented a computer vision algorithm to create a stereographic image for these three images.

Here are the images that we’ve used to test the creation of a stereogram image.

Image of a AI generated Blackhole
Image of a AI generated camel portrait
Image of a bottle

Creating an autostereogram is very exiting and fun to create, before delving into the impementation of a computer vision algorithm to create a stereogram image, ever pondered the fact that how the stereogram images are created. Creating an autostereogram image, also known as a Magic Eye image, requires specific tools and techniques to generate the hidden 3D effect without the need for special glasses or crossing/relaxing your eyes.
The initial step involves generating a depth map of the image, followed by selecting a repeating pattern that will define the structure of your autostereogram. Later combining the depth map and the repeating pattern so that the brightness values of the depth map will determine how the pattern is distorted or shifted to create the 3D effect.

Why is depth map important and how it is useful in the creation of stereographic images ?

A depth map provides the necessary depth information required to generate the illusion of 3D depth perception in a 2D image. A depth map is a grayscale image where each pixel’s intensity represents the distance of the corresponding point in the scene from the viewer’s perspective. Brighter areas indicate objects that are closer, while darker areas represent objects that are farther away. In the process of creating an autostereogram, a repeating pattern is manipulated according to the depth map. The depth map dictates how much to shift or distort the repeating pattern across different parts of the image. Closer objects in the depth map will cause more distortion in the pattern, while farther objects will cause less distortion. These are the important things in creation of a stereographic image. As the viewer’s eyes try to focus on the repeating patterns, the variations caused by the depth map force the eyes to adjust. This adjustment mimics the natural binocular disparity (the slight difference in images between the two eyes due to their horizontal separation) which is how depth perception occurs in normal vision. The brain interprets these manipulations in the pattern as spatial variations, thus perceiving a 3D scene.

Using a computer vision algorithm we have converted the above images to its corresponding depth map and the results are displayed below.

Depth map of a Blackhole
Depth map of scenic view of a camel
Depth map of a bottle

Using the provided depth map, it becomes straightforward to interpret the depth perception of the images. For instance, consider a depth map of a black hole: the ring of light surrounding the black hole appears closer to the observer compared to the black hole itself. As mentioned above the darker areas represents the objects that are far away like the black hole itself and the lighter area: the ring of light that surrounds the black hole appear closer to the observer. The same principle applies to the other mentioned depth maps as well. Each depth map illustrates the relative distances and depth perceptions within the depicted scenes.

After creating the depth maps, we used another computer vision algorithm to create a stereographic images using the above depth map images with a pattern image.

Here are the stereogram images by using the above depth map:

Stereographic image of a Black hole

This is a stereogram of a black hole. Take a moment or two to perceive the hidden 3D image within it.

This is a stereogram of a camel. Take a moment or two to perceive the hidden 3D image within it.

Stereographic image of a camel
Stereographic image of a bottle

This is a stereogram of a bottle. Take a moment or two to perceive the hidden 3D image within it.

So, this is the conventional process for creating a stereographic image using a given image and its corresponding depth map. However, to innovate and add variety to this approach, we have decided to introduce a new method. Our idea involves converting normal images into ASCII art representations, then transforming them into corresponding depth maps to capture depth perception, and finally converting them into stereographic images. This unique approach aims to bring a fresh perspective and creative twist to stereogram creation.

We utilized an algorithm to transform the original image into an ASCII character representation, and the images are given below.

ASCII character representation of a blackhole
ASCII character representation of the scenic view of a camel
ASCII character representation of a bottle

The ASCII representation of a black hole is distinctly clear, showing an almost precise depiction of the black hole. In contrast, the ASCII representation of a scenic view featuring a camel appears dense because the surrounding pixels have similar lightness values, making the camel less distinguishable. Lastly, the ASCII representation of a bottle is sharply visible and recognizable.

Now we have produced depth maps for these ASCII images, which appear quite pixelated. Let’s examine the depth map for each ASCII image individually.

Here is the depth map for the ASCII representation of a black hole. Observe that the brighter ring of light, which is closer to the observer, contrasts with the darker black hole and background, indicating their larger distance from the observer.

Here is the depth map corresponding to the ASCII representation of a camel in a scenic view. Similar to the ASCII image, the camel is not clearly visible in this depth map due to its density and the surrounding pixel values.

Here is the depth map corresponding to the ASCII representation of a bottle. This depth map provides a clear analysis of depth perception.

In the original bottle image, the middle section appears closer compared to the top and bottom due to its bulging shape. Consequently, in this depth map, the middle part is brighter, indicating proximity, while the background is darker, representing farther distance from the observer.

After converting the depth-map images, we transformed them into their corresponding stereogram images. The stereographic images are given below.

Stereographic image of the ASCII art of a black hole
Stereographic image of the ASCII art of a scenic view of a camel
Stereographic image of the ASCII art of a bottle

It can be quite challenging and time-consuming to identify the hidden 3D image within stereogram images. Sometimes, it’s even impossible to discern the hidden 3D image. To verify if the stereogram images are functional, we used an online tool to check for any hidden 3D image. The results of this analysis are provided below.

Hidden 3D image of a black hole
Hidden 3D image of a scenic view of a camel
Hidden 3D image of a bottle

Our approach involves converting original images into ASCII representations, followed by generating corresponding depth maps and ultimately transforming them into stereographic images using computer vision algorithms. Unlike alternative methods that directly use computer vision algorithms for stereogram generation based on depth maps or patterns, our approach introduces an additional layer of complexity by initially converting images into ASCII character representations. This unique twist with ASCII characters adds complexity, making it more challenging to perceive the hidden stereographic images within our creations.

We were curious to know if AI tools like DALL-E, ChatGPT-4, or other image-generating AI models could create stereogram images. To explore this, we prompted ChatGPT-4 with various requests to generate a stereogram image. However, ChatGPT-4, being an image-generating tool, couldn’t directly generate stereogram images. Instead, it provided steps on how to create stereogram images. We uploaded an image of a black hole and requested ChatGPT-4 to convert it into a stereogram image. However, the response we received was not a stereogram image but rather instructions or guidance on how to generate a stereogram image. We went to BingAI and posed the same question that we asked ChatGPT-4, It produced an image with patterns, but it wasn’t a stereogram image.

Stereogram image produces by copilot or called bing AI
Stereogram Image of a black hole generated by bing AI

Therefore, the AI tool currently lacks the capability to generate stereogram images, despite its ability to generate other types of images.

Throughout this project, we utilized a diverse array of tools and resources, including specialized computer vision algorithms designed for image processing and transformation. Our approach was inspired by established stereogram generation techniques while also exploring innovative methods to integrate ASCII representations into the workflow. We leveraged online repositories and tutorials focused on computer vision techniques to inform and refine our process. We have delved further into understanding the mechanics behind stereogram generation by referencing Frolian’s blog post titled “Making Your Own Autostereograms using Python.” Through this exploration, we gained insights into identifying optimal patterns.
By incorporating these advanced algorithms, we ventured into new realms of creativity and visual perception, pushing the boundaries of stereogram artistry to a higher level of complexity and fascination. Whether unraveling the intricate patterns embedded within ASCII characters or appreciating the illusion of depth in stereographic images, this fusion of technology and artistic expression opens up endless possibilities for exploration and experimentation.

We have also shared several other stereogram images below for you to try guessing what each image depicts or identify the hidden 3D image present within them. Please feel free to comment below with your observations and guesses.

Stereogram Image 1
Stereogram Image 2
Stereogram Image 3

This blog post was created by Parithosh Dharmapalan and Pooja Srinivasan.

Categories
Computer Vision

Computer Vision Enhanced Stereograms: From Flat Images to Dynamic 3D Illusions


Stereograms are an old trick that has existed for centuries and consistently amused viewers. Over time, however, stereograms lost their shine and are not as popular. Frankly, prior to exploring the potential applications of computer vision algorithms across different domains, we were entirely unaware of the existence of stereograms.. A fascinating thing about stereograms is that they can create a three-dimensional image from a two-dimensional one. Their remarkable feature lies in how they manipulate depth perception, fooling the brain into perceiving depth and conjuring a vivid 3D image from what was once a mere flat picture. It’s akin to a mesmerizing optical illusion that enchants the eyes!

But, as is the case with everything that has existed for decades, almost every image has been used as a depth map for stereograms. We provided three images: one featuring a black hole, another depicting a camel, and the third showcasing a coke glass bottle. We selected these images for various reasons. Firstly, the black hole image was chosen to challenge viewers and provide a unique experience. We thought it would be really unique to see a black hole in 3D, mainly because we can’t forever wait on NASA to show us a 3D rendering of a black hole. So we decided to take matters into our own hands. Secondly, we utilized DALLE to generate an image of a camel in a desert at sunset, which we found particularly striking and engaging. This choice was made to create a scenic and captivating depiction of a camel in its natural habitat. The third image is a straightforward depiction of a bottle. Our curiosity led us to explore how a bottle would appear in a stereographic 3D image. So we have implemented a computer vision algorithm to create a stereographic image for these three images.

Blackhole image
Camel Image generated by DALLE
A Image of a Bottle

We first started trying to create the stereogram with gusto and our first one was not quite right as we did not grasp the intricacies on how to create one. This led to us not having a stereogram (which consists of depth map and a pattern) but just a patterned image:

We then delved further into understanding the mechanics behind stereogram generation by referencing Frolian’s blog post titled “Making Your Own Autostereograms using Python.” Through this exploration, we gained insights into identifying optimal patterns, ultimately leading us to produce a stereogram featuring a bottle.

Please allow a moment or two for the 3D image of the bottle to fully materialize.

We then followed it up with the AI generated image of the camel and created a stereographic image of a camel:

Please allow a moment or two for the 3D image of a camel to fully materialize.

And then finally the blackhole:

Please allow a moment or two for the 3D image of the blackhole to fully materialize.

The images can be seen in 3D if you give a minute or two you can see the 3D image. It is really easy to figure out the images in 3D in from the stereographic images provided above. A popular method involves employing a depth map, where diverse shades or colors signify different depths in the image. When observed using suitable techniques like cross-eyed or parallel viewing, the brain processes these depth cues to construct a three-dimensional impression. Another approach utilizes repeating patterns known as “random dot autostereograms,” where in the pattern itself holds depth details, and the brain decodes it to perceive the 3D effect. In essence, the crucial aspect is embedding depth cues in the image that the brain can interpret, thus generating the illusion of depth perception.

To enhance the challenge of finding the stereographic image, we opted to transform the original images into ASCII characters before converting them into stereographic images. This additional step renders it even more challenging to uncover the hidden stereographic 3D image. We employed an algorithm to convert each original image into its corresponding ASCII representation. The resulting ASCII images are provided below:

ASCII image of a Blackhole
ASCII image of a camel in a desert
ASCII image of a bottle

Following the conversion of the original images into their respective ASCII representations, we utilized the same computer vision algorithm employed for the previous images to convert the ASCII images into stereographic images.
The ASCII converted stereographic images are listed below.

Stereographic image of a bottle ASCII image
Stereographic image of a camel ASCII image
Stereographic image of a blackhole ASCII image

Now, discerning the hidden stereographic image within the ASCII character converted images is truly challenging, requiring a few minutes to decipher the hidden pattern and identify the 3D stereographic image. This heightened difficulty level adds complexity to determining the actual image when original images are converted into ASCII characters.


The results of our approach involve the successful transformation of original images into ASCII representations and subsequent conversion into stereographic images using computer vision algorithms. In comparison with alternative methods, such as the way of generating a stereographic images through computer vision algorithms, our methods adds an additional layer of complexity by first converting the images into ASCII character representations. The way of generating the stereographic images through computer vision algorithms primarily rely on depth maps or repeating patterns, out approach offers a unique twist by incorporating ASCII characters, making it more challenging to discern the hidden stereographic images.

Throughout this project, we made use of a diverse range of tools and resources, which encompassed computer vision algorithms tailored for image processing and conversion. We drew inspiration from existing stereogram generation techniques and explored innovative ways to incorporate ASCII representations into the process. Additionally, online repositories and tutorials on computer vision techniques served as valuable resources for developing and implementing our approach.

By incorporating computer vision algorithms, we have explored new dimensions of creativity and visual perception, elevating the art of stereograms to a new level of complexity and intrigue. Whether deciphering the subtle patterns within ASCII characters or marveling at the illusion of depth perception in stereographic images, this fusion of technology and artistry offers endless opportunities for exploration and discovery.

This blog post was created by Parithosh Dharmapalan and Pooja Srinivasan.

Categories
Computer Vision

Unraveling the Shibuya Scramble Crossing: Object Detection Algorithm Takes Center Stage !

Ever pondered the sheer number of individuals traversing the zebra crossing, particularly at the Shibuya scramble crossing? Delving further into the Shibuya Scramble Crossing, renowned as Shibuya Crossing, it emerges as a legendary pedestrian scramble intersection in Shibuya, Tokyo, Japan. Situated before the Hachikō exit of Shibuya Station, this vibrant crossing brings traffic to a standstill in all directions, resulting in a captivating spectacle as pedestrians inundate the entire intersection. There are countless number of pedestrians crossing after every interval of two minutes, enough to quickly fill up a football stadium. The phenomenon gave rise to its nickname “scramble,” as pedestrians cross from all directions.

What if we could analyze the number of people that are crossing after every set-interval using Object Detection Algorithm.The Object Detection algorithm enables us to identify the accumulation of individual who intend to cross. Examining the Shibuya scramble crossing under two conditions, during summer and on a rainy day. By feeding a time-lapse video (which contains almost 1700 frames) to the object detection model of the different situations. Surprisingly the number of people crossing in both situation are almost similar. Here’s an example of two different situations people crossing the Shibuya crossing.

Image of people crossing in Summer
Image of people crossing on a Rainy day

The provided images represent individual frames extracted from two separate time-lapse videos. These frames capture the moment when people are crossing, revealing a similar number of individuals in both images. Consequently, we constructed a graph using the data from the two time-lapse videos to accurately depict the actual number of people crossing during each interval at the Shibuya crossing.

Number of people crossing in Summer
Number of people crossing on a rainy day

The images indicate a similar volume of people crossing in both situations. Additionally, we included data on the number of cars detected in each scenario. Interestingly, in the image depicting people crossing on a rainy day, there are more cars detected compared to the clear weather scenario. However, despite this difference, both graphs illustrate a significant number of people crossing the Shibuya crossing. It’s remarkable how this bustling pedestrian intersection stands out as one of Tokyo’s most iconic symbols worldwide.Due to its extensive advertising screens and bustling pedestrian activity, Shibuya Crossing is frequently likened to the Times Square intersection in New York and Piccadilly Circus in London. It is widely regarded as emblematic of Tokyo’s ultra-modern image projected globally.

Utilizing object detection algorithms, we can highlight the remarkable locations in Tokyo. However, when applied to time-lapse videos, these algorithms struggle to accurately detect the number of people or objects due to the rapid pace of the footage. Lower accuracy was observed initially. However, by reducing the speed of the time-lapse video, the accuracy of object detection improved. The algorithm achieves higher accuracy by analyzing each frame of the slowed-down video individually. Furthermore, providing each frame as separate images to the object detection algorithm can further enhance accuracy, allowing for the detection of a greater number of objects.

This blog post was created by Pooja Srinivasan and Parithosh Dharmapalan

Categories
Computer Vision

Evaluating traffic conditions utilizing computer vision

Have you ever pondered the number of vehicles present in a traffic scenario? Have you ever considered the volume of cars navigating through dense traffic? Have you ever contemplated the impact of such traffic on the surrounding routes? We’ve shared these same curiosities and realized the potential to analyze them using computer vision algorithms. We utilized a series of time-lapse images using the coco dataset capturing traffic over a duration and applied an object detection algorithm using YOLO: Real-Time Object Detection to determine the count of vehicles passing within that timeframe.

We conducted an analysis on a collection of time-lapse traffic images using object detection algorithms capable of identifying various vehicle types. Utilizing this data, we calculated the total count of vehicles that traversed through the area and plotted a graph based on the data we collected from running this object model.

The graph was plotted with the number of vehicles on the x-axis against the time taken on the y-axis.The depicted graph illustrates the quantity of vehicles captured by the camera within specific time intervals, condensed from hours to mere seconds. Analyzing this graph reveals a substantial and progressively increasing volume of vehicles at each time interval.

It’s quite remarkable to observe how traffic gradually accumulates over time. Once it initiates at a certain point, it persists until there are no more vehicles present. The buildup of traffic is relentless, ceasing only when either all vehicles have cleared or only a few remain. What’s even more intriguing is our ability to analyze this phenomenon using solely an object detection model.

Numerous occurrences lend themselves to analysis through the application of an object detection model. For instance, we could employ it to scrutinize events like a total solar eclipse, assessing the percentage of the sun obscured during specific time intervals. However, implementation was not feasible as the model lacked training for astronomical events or the analysis of celestial bodies, including those in distant space.

This blog was created by Parithosh Dharmapalan and Pooja Srinivasan.

Categories
Computer Vision

Confusing the Classifier

Since the dawn of time, humanity has always been obsessed with two things: First up is their appearances. With the increased boom in social media, photo editing tools and tweaking images have been at an all time high. The other is dogs. So we decided why not combine the two. 

To start with we chose two dog breeds which are very similar in appearance to see if the classifier can differentiate the two. As you can see the classifier does a very good job in differentiating the Italian Greyhound and the Whippet.

We used three major corruption techniques on our images: editing, doodling and superimposing the images. 

Editing:

The first method we used is editing, where we changed the saturation, exposure, contrast and sharpness of the image. 

After altering the image’s exposure, contrast, saturation, and sharpness, the accuracy of the image classifier in identifying the dog breed decreased.

Overlapping:

Since we noticed that even though the classifier was a bit confused with the edited images, we decided to combine the two images as well as overlap them to see how well it could identify them. And the results are as below:

Doodling:

We then proceeded to doodle on the image by creating a “santa dog” and outlining certain features, the classifier had a hard time to identify the images especially when the different colors were taken into consideration. 

We think the classifier had a hard time classifying  the two images mainly due to the fact that we did choose very similar dog breeds that it was initially hard for us to differentiate between the two and then proceeded to make the situation worse for the classifier with the noise. But overall the classifier did a better job than most humans would have.

Pooja Srinivasan and Parithosh Dharmapalan authored this blog

Categories
Computer Vision

How precise is Bing AI in the realm of Image Processing ?

I came across an article titled “Neptune Is Not Blue: New Study Reveals Eighth Planet’s True Color Has Been Hidden For Decades” by Jamie Carter. In summary, this article explains that Neptune’s true color is ‘pale bluish green’ rather than deep blue. Neptune has traditionally been depicted as a deep azure blue, owing in large part to the first images of both planets, captured by NASA’s Voyager 2 mission in 1986 and 1989, respectively. However, after careful observation with the Hubble Space Telescope and the European Southern Observatory’s Very Large Telescope, researchers have rebalanced the composite color images to reveal the true color of Neptune. This prompted me to ask Bing AI how it perceived the appearance of the planet Neptune. “Copilot serves as the default AI for Bing AI”

“The image on the left has been improved to highlight Neptune’s cloud formations, as captured by Voyager. In contrast, the image on the right represents the authentic color of the planet Neptune captured using Hubble Space Telescope.”

My first question to Bing AI was, “Can you generate images of Neptune?” It responded with an animated rendition of the planet. The majority of AIs that I have used for image generation or image processing have produced results in the form of an animation.

In my second prompt to Bing AI, I expanded my question by asking, “How do you think Neptune looks like? Can you show me an example image?” Bing AI responded by describing Neptune’s color as a “deep blue,” which is consistent with the popular belief that Neptune appears predominantly blue or bright blue. This consensus on the planet’s color is shared by many people, but it also clarified that the color of Neptune does not appear blue, and Bing AI provided an explanation consistent with how many people commonly describe the color of Neptune.

Bing AI provided the following response:

“Neptune, often referred to as an ice giant, is characterized by its rich blue color in images taken at visible wavelengths. This blue appearance is caused by small amounts of gaseous methane in Neptune’s atmosphere1. However, in the near-infrared range, Neptune does not appear blue. The methane gas strongly absorbs red and infrared light, making the planet quite dark at these near-infrared wavelengths, except where high-altitude clouds are present. These methane-ice clouds are prominent as bright streaks and spots, reflecting sunlight before it is absorbed by the methane gas1.
Now, let me generate an image of Neptune for you. Please note that the colors in the image may not represent the true colors of Neptune due to the limitations of the image generation process.”

In my third and final attempt I asked Bing AI “Can you explain about the true color of the planet Neptune and can you generate an image of the true color of the planet Neptune”. Bing AI accurately presented the correct answer in its prompt, stating that: “Neptune, often depicted as a deep azure color, is actually more of a light greenish-blue. This misconception arose from the images taken by Voyager 2 in 1989, which were processed in a way that emphasized contrast and deepened Neptune’s true color, making it appear more blue than it is in reality123. The atmospheric compositions of Neptune and Uranus are almost identical, and they are actually quite similar in color. The main difference is that Neptune is slightly bluer, which is probably the result of a thinner layer of atmospheric haze1. Now, let me generate an image of Neptune for you. Please note that the colors in the image may not represent the true colors of Neptune due to the limitations of the image generation process.”

But the image generated by Bing AI according to the image on the right can be considered slightly more realistic, but it still appears to be artificial. It has illustrated the potential appearance of cloud formations and depicted a pale bluish-green color in the image generated by Bing AI. In conclusion Bing AI possesses updated information regarding the color of Neptune and the resulting image it generated is largely precise. However, reaching this level of accuracy required significant effort on my part.


To sum up, Bing AI’s image processing realm closely aligns with human imagination in envisioning the appearance of objects or planets. This correlation arises from the fact that many people have not directly observed planets with the naked eye. Therefore, the images generated by Bing AI bear some resemblance to how individuals might interpret Neptune based on images from Astrophotography, NASA, and various research space stations.