<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anirudh Topiwala on Medium]]></title>
        <description><![CDATA[Stories by Anirudh Topiwala on Medium]]></description>
        <link>https://medium.com/@topiwala.anirudh?source=rss-4766029575de------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4vRBqI4BkcH_PCSfpVON-w.jpeg</url>
            <title>Stories by Anirudh Topiwala on Medium</title>
            <link>https://medium.com/@topiwala.anirudh?source=rss-4766029575de------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 21:26:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@topiwala.anirudh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Visualizing Sound in the Wild]]></title>
            <link>https://medium.com/@topiwala.anirudh/visualizing-sound-in-the-wild-b500657b0d85?source=rss-4766029575de------2</link>
            <guid isPermaLink="false">https://medium.com/p/b500657b0d85</guid>
            <dc:creator><![CDATA[Anirudh Topiwala]]></dc:creator>
            <pubDate>Tue, 12 Apr 2022 06:53:13 GMT</pubDate>
            <atom:updated>2022-04-16T07:40:29.507Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>What if you could capture sound in an image? What if you could add another dimension to a still photograph? What if you could make a picture come alive?</blockquote><p>Find the answers below…</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXUllsgl0diw&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXUllsgl0diw&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/565ba33eb41f87721182399332a56b19/href">https://medium.com/media/565ba33eb41f87721182399332a56b19/href</a></iframe><p><strong>Intrigued yet? Read on …</strong></p><blockquote>Alternatively, try it out yourself with your own voice using my app <a href="https://share.streamlit.io/anirudhtopiwala/visualize_sound_in_the_wild/main/web_app.py"><strong>Visualizing Sound in the Wild</strong></a>. Or, you can find a demo of the app in the video <a href="https://www.youtube.com/watch?v=9ukxZZZUCMQ">here</a>.</blockquote><p>Sound is defined by the vibration of molecules which propagate as a wave in a medium like air or water. There are many ways to visualize sound. In the simplest form, the sound waves can be converted into an electrical signal using a microphone. When the same waves are visualized through a physical medium like sand or water, its called C<a href="https://en.wikipedia.org/wiki/Cymatics">ymatics</a>. A more scientific form of visualizing sound waves is through a <a href="https://en.wikipedia.org/wiki/Spectrogram">Spectrogram</a>, where the amplitudes and frequency of the wave are more easily discernible. These are a handful of methods that gives us unique ways to visualize sound. But they don’t capture how the sound was made, nor do they help capture the moment pictorially. That’s where the motivations of this article lies. I wanted a way of capturing an image with sound encoded in it as a way to make the world in that image more tangible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O9FfpHR_lq93HrMwbcNq4A.gif" /><figcaption>Fig 1: (a) Sound pressure wave created by vibrating molecules pushed upon by a piston. <a href="https://gfycat.com/assuredvalidchickadee">Ref</a> (b) Modes of sound formed by sand particles. <a href="http://arch365bilgi.blogspot.com/2019/03/cymatics.html">Ref</a> (c) Spectrogram of flute sounds where the different rows of sound represent different frequencies and the warmer colors represent higher amplitude. <a href="https://musiclab.chromeexperiments.com/spectrogram/">Ref</a></figcaption></figure><p>A similar argument can be made for pictures. Pictures have evolved over the years from grayscale to color to high definition pictures. Pictures have become more and more tangible by adding the ability to geo-tag locations, tagging people or now by adding various filters to a picture. Heck, the greatest example of making a picture come alive are the picture frames of Harry Potter. I am a big fan of how adding a small video clip can convey so much more information and make it much more visually stimulating. This is what I want to do with images and sound.</p><blockquote>I want to make the pictures come alive with sound !!!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*VTWmP8IJGuvUBGTHP7IRug.gif" /><figcaption>Harry Potter Gryffindor Common Room maybe? <a href="https://www.pinterest.com/pin/16395986119677899/">Ref</a></figcaption></figure><h3>Visualizing Sound — How does it work?</h3><p>The idea of opening up pictures to another dimension is extremely exciting. But how can we do this? Let’s look at another example before diving in.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FYdY4I7n0Cpw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DYdY4I7n0Cpw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FYdY4I7n0Cpw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/284231472daa728ceac92a64fe00e396/href">https://medium.com/media/284231472daa728ceac92a64fe00e396/href</a></iframe><h4>How Sounds Works?</h4><blockquote>Sound waves are made up of three critical pieces of information: <strong>amplitude, frequency and time</strong>. It can be thought of as a mix of multiple single frequency sound waves <a href="https://en.wikipedia.org/wiki/Superposition_principle">superpositioned</a> on each other. Fig 2 shows how the sound wave (red) can be broken down into its 6 different sub component frequencies which are shown in blue. This is achieved by using <a href="https://en.wikipedia.org/wiki/Fourier_transform">Fourier Transform</a>. <strong>Essentially, this converts the sound wave from a time domain to a frequency domain. Time domain is where we observe the combined amplitude (loudness) of individual sound waves over time. Whereas, frequency domain isolates the frequencies and the amplitudes of each individual sound wave into discrete units. </strong>As it is very difficult to capture information across these three dimensions and overlay it on an RGB image, we focus on the time domain and capture the loudness of the sound over time. <a href="https://medium.com/u/3fd5a49d1e91">Kartik Chaudhary</a> has a great <a href="https://towardsdatascience.com/understanding-audio-data-fourier-transform-fft-spectrogram-and-speech-recognition-a4072d228520">post</a> which dives more into Fourier Transform.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*0UJ6h_EDOPYIpk7P3J-0pg.gif" /><figcaption>Fig 2: Sound waves in red shows the time domain which depicts the variance of combined amplitude over time . The Fourier transform splits the wave into its respective frequencies and amplitudes shows in blue. In this case the sound wave was made up of 6 distinct frequencies at different amplitudes. (Source: L<a href="https://commons.wikimedia.org/wiki/User:LucasVB">ucas Vieira</a> on <a href="https://commons.wikimedia.org/wiki/File:Fourier_transform_time_and_frequency_domains.gif">Wikipedia</a>)</figcaption></figure><p>Another observation which can be made from Fig 2 is that, a sound wave is a mix of distinct sinusoidal waves. <strong>That is, any complex sound wave can be broken down into its component sin waves.</strong> Fig 3 shows sound waves generated from different sources. A flute produces a more uniform sin wave which has fewer number of distinct frequencies Fig3 (a). Similarly a person whistling has a shrill sound and therefore we get a higher <a href="https://byjus.com/physics/loudness-of-sound/">pitch</a> wave with relatively fewer frequencies Fig 3 (b). On the other hand, human voice is much more complex and has distinct frequency waves ranging from approximately 80 to 255 HZ as shown in Fig 3(c).</p><blockquote>You can try this out yourself in the <a href="https://share.streamlit.io/anirudhtopiwala/visualize_sound_in_the_wild/main/web_app.py">web app</a> from which the below visualizations are made. Try whistling and shouting to see how the pitch of the sound wave changes!!!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*ivLQPR5A-fqcFah7O8ZG1Q.gif" /><figcaption>Fig 3: (a) Wave generated from a flute (b) Waves generated from whistling sounds (c) Waves generated from human speech (Source: Author)</figcaption></figure><h4>How visualizing sound works?</h4><blockquote>Visualizing sound in the time domain boils down to encoding the amplitude or the loudness of sound over time in the image. <strong>I do this by, adjusting the brightness of the image based on the maximum amplitude values.</strong></blockquote><p>Therefore, the max amplitude over a given time range controls how dark or bright the image would be. This is very effective, as changing the brightness of the image still retains the original colors and beauty of the image whilst encoding the amplitude values in it. However, as I had said earlier, we can go a step further and encode sound only in the area which relates to its source of creation or connects to it meaningfully. This is achieved by masking the image and only encoding the amplitudes in masked region of the image. Fig 4.a shows variation of the sky by chirping of birds among the trees. Similarly, the gushing sound of water falling over 620 ft is visualized in the waterfall. Or the sound from the carousel vary the lights on the Seattle Wheel. Click the links attached in the Figure below to hear the actual sounds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*jj-M9SNQ69tINOjrIB39hQ.gif" /><figcaption>Fig 4: (b) <a href="https://youtube.com/shorts/YdY4I7n0Cpw">The Mighty Multnomah Falls</a> (b) <a href="https://youtube.com/shorts/kIUXiqmtZqg">Seattle Great Wheel</a> c) <a href="https://youtu.be/XUllsgl0diw">Hiking among the trees</a>(Source: Author)</figcaption></figure><p>Okay, so we encoded amplitude. But what about time?</p><p>This is where the human vision comes into play. Humans usually see through their eyes at 30 to 60 frames per second (<em>fps</em>). Meaning our brain goes through about 60 images per second to see the world around us. Although, this also means that there is a fixed number of amplitudes values which can vary the brightness of the image per second. For human speech the average frequency of sound wave is about 160 hz (<em>Freq</em>). Which would mean there are 160 * 2 = 320 amplitude values per second. This because each wave has a positive and a negative amplitude. So the number of amplitudes values which needs to be encoded in each picture frame can be calculated by-</p><p>Amplitudes to encode per picture frame (<em>chunk_size</em>)= <em>Freq</em> * 2 / <em>fps</em> = 320 / 60 = 5.33.</p><p>As it is not possible to vary the brightness of the picture by 5.33 values at the same time, the sound amplitudes are split into equal chunks of <em>chunk_size. </em>The maximum amplitude in each chunk will be represent the overall amplitude for that period of time. As amplitudes are relative displacement of particles, it can be positive or negative and therefore, we encode the absolute maximum amplitude in the picture frame.</p><blockquote><strong><em>Thus, if we create a video with 320 fps, we can encode all the amplitude values in one second and capture actual human speech in the picture in the form of a video. We can then compare the encoded video against a base image and recreate the original amplitude-time sound wave from the video. Which is pretty cool !!!</em></strong></blockquote><p>I have not tried recreating sound wave from the encoded video so far but you can definitely give it a try. I can already picture Tom Cruise in Mission Impossible using this to decrypt his mission statement and save the world again 😏.</p><p>The code on how amplitude values are encoded is open source and is available on my <a href="https://github.com/anirudhtopiwala/visualize_sound_webapp">GitHub repository</a>.</p><p>The variation of <em>fps </em>and the pulsating effect it creates can be specially visualized by the <a href="https://share.streamlit.io/anirudhtopiwala/visualize_sound_in_the_wild/main/web_app.py"><strong>Visualize Sound — YouTube</strong></a><strong> </strong>part of the app. Try changing, the <em>fps </em>here. A higher <em>fps </em>would result in a faster pulsating effect and would capture more amplitudes of the sound wave.</p><blockquote>The most crucial aspect of visualizing sound this way is, unlike other methods of visualizing sound like c<a href="https://en.wikipedia.org/wiki/Cymatics">ymatic or </a><a href="https://en.wikipedia.org/wiki/Spectrogram">spectrogram</a>, we preserve the essence of the original image whilst encoding sound into the image.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FkIUXiqmtZqg&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkIUXiqmtZqg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce4cea2500e031cf75c7f1b2a7210e11/href">https://medium.com/media/ce4cea2500e031cf75c7f1b2a7210e11/href</a></iframe><h3>Visualize Sound Web App</h3><p>If you made it till here, you would be psyched to know that I have made an app that lets you visualize sound in real time on any image of your liking. It also lets you visualize audio from any YouTube video giving you the ability to make your own images comes alive.</p><p>The app is called <a href="https://share.streamlit.io/anirudhtopiwala/visualize_sound_in_the_wild/main/web_app.py">Visualizing Sound In the Wild</a>. Its made using <a href="https://streamlit.io/">Streamlit</a>, and is hosted by two platforms. Streamlit Share and Heroku. Be on the lookout for another post where I dive deeper into the app and explain how I used Streamlit and why its a great entry point to create your own apps.</p><p>Links to both the hosted apps are below:</p><ol><li><a href="https://share.streamlit.io/anirudhtopiwala/visualize_sound_in_the_wild/main/web_app.py">Visualizing Sound In the Wild on Streamlit Share</a></li></ol><p>2. <a href="https://visualize-sound.herokuapp.com/">Visualizing Sound In the Wild on Heroku</a></p><p>Both the platforms are hosting the same app to create redundancy in making sure at least one of them is online. This is because, as I am using the free versions of the app, the app only gets 1GB of memory and hence crashes very often due to out of memory problems. In case both these apps are not available, see these <a href="https://github.com/anirudhtopiwala/Visualize_Sound_In_The_Wild#run-the-app-locally">instructions</a> to run the app locally on your machine.</p><p>The app and the code is open sourced and is available on my G<a href="https://github.com/anirudhtopiwala/visualize_sound_webapp">ithub repository</a>.</p><blockquote><em>Exclusive access to the original HD pictures showcased in this blog and the sounds captured can be accessed through </em><a href="https://opensea.io/collection/visualize-sound"><em>NFTs</em></a><em> on </em><a href="https://opensea.io/collection/visualize-sound"><em>opensea.io</em></a><em>.</em></blockquote><p>Here is a demo of the app with some more motivation for the project.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F9ukxZZZUCMQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9ukxZZZUCMQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F9ukxZZZUCMQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6bea2dfca79c2f2b5d1f27c644bc45bf/href">https://medium.com/media/6bea2dfca79c2f2b5d1f27c644bc45bf/href</a></iframe><p>This idea of visualizing sound and making pictures come alive can also be extended to other fun application. For example a new Snapchat or Instagram filter (<a href="https://medium.com/u/a4c6efa67fe0">Instagram Engineering</a>)? Or how about a YouTube Short or a reel? Think of it like tagging sound in an image instead of a location, but in a more visual way.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FnDn1x1KHtOQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DnDn1x1KHtOQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FnDn1x1KHtOQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3c5cd93ff2b5c8f78f9a4bfdfba6c9b/href">https://medium.com/media/b3c5cd93ff2b5c8f78f9a4bfdfba6c9b/href</a></iframe><p>There are many applications of this algorithm. In this blog, we mostly covered how we can visualize sound in an image. But, sound wave is like any other wave form and a similar approach can be used to visualize any other wave in the electromagnetic spectrum. For example, imagine visualizing the picture of Jupiter based upon the infrared waves emitted from the planet. That is pretty cool !!!</p><blockquote>Images historically have always been limited to singular sense of sight. Would this approach expand the dimensions to the sense of sight as well as hearing?</blockquote><p>Please comment with your idea of how we can make images more tangible?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b500657b0d85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Live Background Blur..How Does It Work?]]></title>
            <link>https://medium.com/swlh/live-background-blur-how-does-it-work-4c0491bcf2fa?source=rss-4766029575de------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c0491bcf2fa</guid>
            <category><![CDATA[live-background-blur]]></category>
            <category><![CDATA[depth-estimation]]></category>
            <category><![CDATA[deeplab]]></category>
            <category><![CDATA[semantic-segmentation]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Anirudh Topiwala]]></dc:creator>
            <pubDate>Mon, 16 Nov 2020 04:03:54 GMT</pubDate>
            <atom:updated>2020-11-17T17:59:03.097Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9KHgHggLeTJLZUYVAGvdKQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@todd_diemer">Todd Diemer</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><p>Ever since the pandemic began it has affected all aspects of life. For me it was March 23, 2020 when I got the email that we will be working from home for the time being. Fast forward 8 months and I am writing this article in my sweat pants working from home. Among this chaos, everyone has moved towards the digital world of working online making video conferencing the glue holding everything together. Early on, Zoom made video conferencing much easier with background blur and being able to change the background to places like Hawaii. But now, its offered by almost all the VC applications like Google Meet, Zoom and even Skype (Yes, some people still use Skype). Being a computer vision engineer myself, I became curious on how does the background blur work? Seemed like a simple case of image segmentation for human pixels and use the mask to change or blur the background. Surprisingly I did not find a lot of projects on Github. So, I decided to take a shot and see if I can get anywhere near these big companies. My code is available on Github <a href="https://github.com/anirudhtopiwala/OpenSource_Problems/tree/master/Background_Blur">here</a>.</p><p>Let’s look at some results before we get our hands dirty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*PaMBM5AT8YcTomiC9Fcz8g.gif" /><figcaption>Using MiDaS to blur the Background !!!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*LV7SjjmRT2TQaqzC_pcdgw.gif" /><figcaption>Using DeepLabv3 to blur the Background !!!</figcaption></figure><p>The above results are obtained from using two different models. The one above is using <a href="https://github.com/intel-isl/MiDaS">MiDaS</a> and the one below is using <a href="https://github.com/tensorflow/models/tree/master/research/deeplab">DeepLabV3</a>. You might wonder why I selected these models specifically? Well, firstly, because they are readily available trained on millions of images from <a href="https://pytorch.org/hub/">PyTorch Hub</a>. Secondly, because both these models are very different underneath. DeepLabv3 is a semantic segmentation model and MiDaS is a monocular depth estimation model. Comparing such different ideas to solve the same problem seemed exciting to me.</p><p>As both the models are very different in the way they work, trying to explain both the models in detail will make this article long and tedious to read. Therefore I will try and do my best to summarize them and hopefully talk about it in detail separately. I will start with going over each model and then dig into the results. Finally, I will take this opportunity to compare my method with that of Google meet’s, which seems to be the best live background blur tool in the market.</p><h4>DeepLabv3 — Semantic Segmentation</h4><p>DeepLabv3 is a semantic segmentation network which is a state-of-the-art segmentation model designed and open-sourced by Google. Semantic segmentation is the process of classifying each pixel of the image into different classes which essentially answers:</p><p><em>&quot;What&#39;s in this image, and where in the image is it located?”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yh_i-qwKUnVo_ClmIBqoVQ.png" /><figcaption>Semantic Segmentation using Deeplabv3 (<a href="https://arxiv.org/pdf/1706.05587.pdf">Source</a>)</figcaption></figure><blockquote>The DeepLabv3 is able to combine the success of encoder-decoder architecture with Atrous convolution for the purpose of semantic segmentation.</blockquote><p>This combination has given DeepLabv3 the ability to:</p><ol><li>Handle objects at multiple scales for variable scale images.</li><li>Accurately localize objects without losing spatial accuracy.</li><li>Capture sharper object boundaries.</li></ol><p>Atrous convolution is at the heart of the state-of-the-art performance of this model. Atrous convolution or dilated convolution is the ability to have spacing between the values of the kernel by a fixed distance which is called the dilation rate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/0*okff_J8D6k19A7Y0.gif" /><figcaption>Dilation rate of 2 and no padding. (<a href="https://towardsdatascience.com/review-dilated-convolution-semantic-segmentation-9d5a5bd768f5">Source</a>)</figcaption></figure><p>This helps the filter to <strong>enlarge its field of view to incorporate larger context. </strong>By<strong> </strong>controlling the rate or the gap between the values, we can control the field-of-view and find the best trade-off between accurate localization (small field-of-view) and context assimilation (large field-of-view). This is depicted by the figure on the left. Because of the gaps in the kernel, atrous convolution is also called filter with holes.</p><p>The equation for atrous convolution is given below, where r=1 makes it the equation for standard convolution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/0*_AUB3OPPuxv_YAPc.png" /><figcaption>1D Atrous Convolution (r&gt;1: atrous convolution, r=1: standard convolution) (<a href="https://arxiv.org/pdf/1606.00915.pdf">Source</a>)</figcaption></figure><p>Now that we understand what atrous convolution is, it is important to understand its effect on an image. The figure on the left below demonstrates the ability of atrous convolution to retain denser feature map compared to normal convolution without additional weights or parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*1ElZaT13e7c38-pR2rI3aA.png" /><figcaption>(Left)Top row: regular convolution followed by up-sampling. Bottom row: atrous convolution resulting denser feature map. (<a href="https://arxiv.org/pdf/1606.00915.pdf">Source)</a> (Right) Encoder Decoder architecture with ASPP (<a href="https://openaccess.thecvf.com/content_ECCV_2018/papers/Liang-Chieh_Chen_Encoder-Decoder_with_Atrous_ECCV_2018_paper.pdf">Source</a>)</figcaption></figure><p>The figure on the right above depicts the encoder-decoder architecture combined with ASPP( Atrous Spatial Pyramid Pooling). ASPP is basically combining different atrous convolutions at various rates (dilation rate) to make it able to capture object information at variable scale. This combination of these features have made DeepLabv3 the best semantic model of all time until DeepLabv3+ came along the way :). Here, they further develop the decoder module to improve the segmentation results by further refining the boundaries of segmentation. To learn more about DeepLabv3, you can find the paper <a href="https://arxiv.org/pdf/1706.05587.pdf">here</a> and some succinct articles here. <a href="https://towardsdatascience.com/the-evolution-of-deeplab-for-semantic-segmentation-95082b025571">[4]</a> <a href="https://towardsdatascience.com/review-deeplabv3-atrous-convolution-semantic-segmentation-6d818bfd1d74">[5</a>] <a href="https://developers.arcgis.com/python/guide/how-deeplabv3-works/">[6].</a></p><p>Let’s now switch gears to talk about MiDaS.</p><h4>MiDaS (Monocular Depth Estimation)</h4><p>MiDaS is the latest state-of-the-art monocular depth estimation model open sourced by <a href="https://github.com/intel-isl">Intel Intelligent Systems Lab</a>. Monocular depth estimation is the process of estimating depth from single (mono) image.</p><blockquote>A depth image is where each pixel of the image has some depth value associated with it.</blockquote><p>This depth could be true depth or relative depth. The lower row of the image below represents the relative depth that is generated by the model. The brighter the image, the closer the object is to the camera and vice versa.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X8mwlRGeu8thmhwUnsTyyQ.png" /><figcaption>Relative Depth Map from MiDaS (<a href="https://arxiv.org/pdf/1907.01341.pdf">Source</a>)</figcaption></figure><p>Depth estimation from a single image is in itself an ill-posed problem, meaning that in practice there is no way we can get the exact depth of the scene from a single image. This is because different 3D objects can project to the same 2D object in the image (Projection ambiguity). The same goes for scale, as objects</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fPgpSj39x72TQMNe_a4t1w.png" /><figcaption>Left: Projection Ambiguity, Right: Scale Ambiguity (<a href="https://towardsdatascience.com/depth-estimation-1-basics-and-intuition-86f2c9538cd1">Source</a>)</figcaption></figure><p>at different scales can look the same size in an image when placed farther away from the image. (Scale ambiguity). Therefore being able to estimate accurate depth even on a relative level would be ground breaking work.</p><p>Depth information can be obtained through various methods and depending upon the method used, different deep learning architectures can be employed to generate depth images. There are three most common type of depth datasets: 1) Absolute or true depth datasets, which can be obtained from laser based measurements or calibrated stereo cameras, 2) Depth up to an unknown scale from SFM (Structure from Motion) and 3) Relative Depth or in Disparity Maps which are obtained from uncaliberated stereo cameras. Over the last several years different deep learning architectures have been built around these three types of datasets to generate depth images, but the most common problem is the models ability to generalize. Most of the time, models perform very poorly cross different datasets. It is also not straight forward to evaluate models across different types of datasets. To address these problems, MiDaS proposes that the best way to build a network that can generalize well is to combine the different types of datasets. They identify three main challenges:</p><ol><li>Inherently different representations of depth: direct vs. inverse depth representations.</li><li>Scale ambiguity: for some data sources, depth is only given up to an unknown scale.</li><li>Shift ambiguity: some datasets provide disparity only up to an unknown scale. Also some datasets have a global disparity shift because of some post processing steps.</li></ol><p>These challenges are addressed by designing a novel flexible loss function that can handle data across different datasets and still be able to help converge the network. Further, they also provide a dataset generated by uncalibrated stereo images obtained from 3D movies. (Who thought movies would be used to train deep learning models !!!).</p><blockquote>With the above approach they were able to combine 10 different datasets (ReDWeb, DIML, Movies, MegaDepth, WSVD, TartanAir, HRWSI, ApolloScape, BlendedMVS, IRS) trained over approximately six GPU months of computation and produced a state-of-the-art monocular depth estimation model which I have used for background blurring.</blockquote><p>To learn more about how the flexible losses are defined and how the datasets were combined, I would highly recommend going over the paper <a href="https://arxiv.org/pdf/1907.01341.pdf#cite.Xian2018">here</a>.</p><h3><strong>Lets Blur it away!!!</strong></h3><p>Enough theory.. lest look at some results. As a reminder, the code can be found <a href="https://github.com/anirudhtopiwala/OpenSource_Problems/tree/master/Background_Blur">here.</a></p><p>For both the methods, the process is very similar. We want to get a mask of the person/object in the image. Then use the negative of this mask and blur the background. Different blurring algorithms can be used here, I have selected <a href="https://docs.opencv.org/master/d4/d13/tutorial_py_filtering.html">Gaussian blur</a>.</p><p>For <strong>DeepLabv3</strong> or the semantic segmentation model, we isolate all the pixel which have the label ‘person’ associated with it. This will make up our mask. With the mask available we can find the background by taking its negative and apply it to the original image. The results are shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*gYrgzvjgXwsxdssxWQS17w.gif" /><figcaption>Left: Original image Middle: Blurred Image Right: Object Mask</figcaption></figure><p>For <strong>MiDaS</strong> or the monocular depth estimation model, we initially get the relative depth of the image. As the depth is relative, we can binarize the depth image by thresholding. The thresholding value is set to 0.6 x max_depth. This means all the pixels with depth at least 0.6 times the max depth value found in the image will make up the mask. This way we can blur everything in the background other than whats nearest to the camera. The binary image formed is shown in bottom right of the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*17lwBN38lKrltiYnlRVx_Q.gif" /><figcaption>Top Left: Original, Top Right: Blurred, Bottom Left: Depth Image, Bottom Right: Mask</figcaption></figure><p><strong>Lets Compare!!!</strong></p><p>Looking at both the models, they seem to working reasonably well. However, I think the depth estimation method is more robust. This is because in case of the Deeplabv3, if a person walks behind me then it will detect it as a person and unblur that area as well and I don’t think having your annoying friend walking behind you being visible in your meetings is something you would want. However, in case of MiDaS, this would not happen as the mask is made of objects which are nearest to the camera.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*bBhb4cYfAvzMJxlOhquTEA.gif" /><figcaption>MiDaS on the left and Deeplabv3 on the right.</figcaption></figure><p>I also think the MiDaS does a better job on creating sharper masks around small objects like around my fingers. On the other hand, MiDaS suffers from the <a href="https://arxiv.org/pdf/1905.07005.pdf">well known problems</a> of monocular depth estimation wherein objects in the lower part of the image are sometimes detected near the camera even if they are not. This is whats happening in the lower right of the MiDaS video. So, I guess there are no clear winners here.</p><p>Another point of comparison is the inference speed. Both the models were run on a single 6GB Nvidia GTX 1060 graphics card with 480x640 image inputs. The MiDaS model was able to get an inference rate of 4.5 fps (frames per second) whereas DeepLabv3 ran at 2.5 fps. Here, MiDaS seems to be the clear winner with almost twice the inference speed as that of DeepLabv3.</p><p>Disclaimer: All the background blur videos inferred with MiDaS and DeepLabv3 in this blog post appears to be real-time or at 30 fps. This is because comparing these methods with different frame rates was being very difficult and therefore the videos are made from image frames that are processed individually. The actual frame rates for MiDaS and Deeplabv3 are 4.5 fps and 2.5 fps respectively.</p><h4>Comparing performance with Google Meet.</h4><p>I have been in awe of the blurring feature of google meet ever since they introduced the feature a month back. I have been playing with it with different backgrounds and lighting conditions and it performs reasonably well. In fact, it is what led me to investigate this on my own. But I got to say the performance of the MiDaS model on the left, is as good as or even a pinch better than the google meet video on the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ri-d29C2x-ioFkA5oe5P0A.gif" /><figcaption>Left: Background Blur using MiDaS, Right: Background Blur using Google Meet.</figcaption></figure><p>If you look closely in the google meet video, there is a picture of a bird in the background that is getting unblurred very often which makes me believe that it might be using a segmentation model under the hood like Deeplabv3. The MiDaS model performs flawlessly in this regard.</p><p>However, we should not forget that meet is doing this over the web at 30 fps without a GPU locally whereas the MiDaS model is running at 4.5 fps with a GPU. Although, I wonder if Google Meet, used a depth estimation model. Would that improve their performance?</p><blockquote>What do you guys think, how is google meet blurring the background?</blockquote><p>Feel free to reach out to <a href="https://anirudhtopiwala.com/">me</a> and share your idea of background blurring. Who knows, maybe we can take on google meet! :)</p><h3>References</h3><ol><li>Chen, L.-C., Papandreou, G., Schroff, F., and Adam, H., “Rethinking Atrous Convolution for Semantic Image Segmentation”, 2017.</li><li>Chen LC, Papandreou G, Kokkinos I, Murphy K, Yuille AL. “DeepLab: Semantic Image Segmentation with Deep Convolutional Nets, Atrous Convolution, and Fully Connected CRFs.” , 2017.</li><li>Lasinger, Katrin et al. “Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-Shot Cross-Dataset Transfer.” , 2020.</li><li>T. Van Dijk and G. De Croon, “How Do Neural Networks See Depth in Single Images?,” <em>2019 IEEE/CVF</em>, 2019.</li><li><a href="https://towardsdatascience.com/the-evolution-of-deeplab-for-semantic-segmentation-95082b025571">https://towardsdatascience.com/the-evolution-of-deeplab-for-semantic-segmentation-95082b025571</a></li><li><a href="https://developers.arcgis.com/python/guide/how-deeplabv3-works/">https://developers.arcgis.com/python/guide/how-deeplabv3-works/</a></li><li><a href="https://towardsdatascience.com/review-deeplabv3-atrous-convolution-semantic-segmentation-6d818bfd1d74">https://towardsdatascience.com/review-deeplabv3-atrous-convolution-semantic-segmentation-6d818bfd1d74</a></li><li><a href="https://towardsdatascience.com/depth-estimation-1-basics-and-intuition-86f2c9538cd1">https://towardsdatascience.com/depth-estimation-1-basics-and-intuition-86f2c9538cd1</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c0491bcf2fa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/live-background-blur-how-does-it-work-4c0491bcf2fa">Live Background Blur..How Does It Work?</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is the Point Inside the Polygon?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/is-the-point-inside-the-polygon-574b86472119?source=rss-4766029575de------2"><img src="https://cdn-images-1.medium.com/max/764/1*DpniaSbB6xx9aDmrVc8LIQ.png" width="764"></a></p><p class="medium-feed-snippet">&#x201C;In computational geometry, the point-in-polygon (PIP) problem asks whether a given point in the plane lies inside, outside, or on the&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/data-science/is-the-point-inside-the-polygon-574b86472119?source=rss-4766029575de------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/is-the-point-inside-the-polygon-574b86472119?source=rss-4766029575de------2</link>
            <guid isPermaLink="false">https://medium.com/p/574b86472119</guid>
            <category><![CDATA[point-in-polygon]]></category>
            <category><![CDATA[pip]]></category>
            <category><![CDATA[point-in-convex-polygons]]></category>
            <category><![CDATA[point-in-trapezoid]]></category>
            <category><![CDATA[winding-number]]></category>
            <dc:creator><![CDATA[Anirudh Topiwala]]></dc:creator>
            <pubDate>Thu, 10 Sep 2020 05:51:33 GMT</pubDate>
            <atom:updated>2023-03-31T15:15:48.839Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Vector Projection and Overlapping Vectors]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/vector-projection-and-overlapping-vectors-523a5896db1f?source=rss-4766029575de------2"><img src="https://cdn-images-1.medium.com/max/1016/1*D8OSZ5Dyz5nzTgGRf-zI4g.png" width="1016"></a></p><p class="medium-feed-snippet">Vector projection is used to derive useful observations like check if a point lies on a vector or if two vectors are overlapping each&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/data-science/vector-projection-and-overlapping-vectors-523a5896db1f?source=rss-4766029575de------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/vector-projection-and-overlapping-vectors-523a5896db1f?source=rss-4766029575de------2</link>
            <guid isPermaLink="false">https://medium.com/p/523a5896db1f</guid>
            <category><![CDATA[vector-projection]]></category>
            <category><![CDATA[vector]]></category>
            <category><![CDATA[vector-dot-product]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[math]]></category>
            <dc:creator><![CDATA[Anirudh Topiwala]]></dc:creator>
            <pubDate>Mon, 24 Aug 2020 17:49:45 GMT</pubDate>
            <atom:updated>2022-04-01T08:44:53.790Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Spherical Projection for Point Clouds]]></title>
            <link>https://medium.com/data-science/spherical-projection-for-point-clouds-56a2fc258e6c?source=rss-4766029575de------2</link>
            <guid isPermaLink="false">https://medium.com/p/56a2fc258e6c</guid>
            <category><![CDATA[spherical-projection]]></category>
            <category><![CDATA[point-cloud]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[semantic-segmentation]]></category>
            <dc:creator><![CDATA[Anirudh Topiwala]]></dc:creator>
            <pubDate>Sat, 28 Mar 2020 00:11:10 GMT</pubDate>
            <atom:updated>2021-04-28T02:53:12.015Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello Everyone, this is my first medium post and I hope to engage everyone till the very end. In this post, I am going to talk about how to project a 3D point cloud into an image using spherical projection. I have also written code for the same which is available on my GitHub repository <a href="https://github.com/anirudhtopiwala/OpenSource_Problems/tree/master/Spherical_View_Projection">here</a>. So lets get started!!!</p><p>Spherical Projection or Front View projection is nothing but a way to represent the 3D point cloud data into 2D image data, and so essentially, it also acts as a dimensionality reduction method. Spherical projection is increasingly being used in different deep learning solutions for processing point clouds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*LeHUFEgfKsXu5gmtO5bycg.png" /><figcaption>Semantic Segmentation (Author: <a href="http://semantic-kitti.org/">SemanticKitti</a>)</figcaption></figure><p>One of the most applied area is to classify and segment objects in a point cloud. This can be seen in various publications like <a href="https://arxiv.org/abs/1807.06288">PointSeg</a>, <a href="https://arxiv.org/abs/1710.07368">SqueezeSeg,</a> <a href="https://www.groundai.com/project/salsanet-fast-road-and-vehicle-segmentation-in-lidar-point-clouds-for-autonomous-driving/1">SalsaNet</a> and so on. The biggest advantage of representing a point cloud as an image is that it opens up all the research done in the last decade on 2D images to 3D point clouds. For example, different state-of-the-art networks like <a href="https://people.eecs.berkeley.edu/~jonlong/long_shelhamer_fcn.pdf">FCN</a>, <a href="https://arxiv.org/abs/1505.04597">U-Net</a>, <a href="https://arxiv.org/abs/1703.06870">Mask-RCNN</a>, <a href="https://arxiv.org/abs/1506.01497">and Faster-RCNN</a> can now be extended to point cloud data and this is what a lot of researchers are trying to accomplish, especially in the self-driving field.</p><h3><strong>Intuitive Explanation</strong></h3><p>To understand this lets dig into how one point cloud scan is formed by a lidar. Let’s consider the case of a 16 laser lidar shown in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FEg6D6V_CzlSaDsCxXzfLg.png" /><figcaption>The figure on the left shows a lidar which consists of 16 lasers. The max and min angle of view formed by the first and the last laser of the lidar are indicated by FOV_Up and FOV_Down. The rectangle on the right is what we get when we project the hollow cylinder formed by the lidar onto a plane. (Author: Anirudh Topiwala)</figcaption></figure><p>Each of the 16 lasers are oriented at a fixed angle depending upon the vertical angular resolution, FOV_Up (Upper Field of View) and FOV_Down (Lower Field of View). Each lidar has a firing and a receiving unit. The points are formed by calculating the time of flight for each laser after it has been reflected from the object. These 16 lasers when rotated by 360 degrees form one point cloud.</p><blockquote>Thus the geometric shape this will result into is a<strong> hollow cylinder</strong> with the lidar at its center. When we project this hollow cylinder looking from an axis perpendicular to principal axis of the cylinder, onto a plane, we get an image. This image is called spherical projection image.</blockquote><h3><strong>Let’s get technical with some Math now!!</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dwx4RdGRknJUk415dZoILw.png" /><figcaption>(Author: Anirudh Topiwala)</figcaption></figure><p>Our goal is to find pixel coordinates of the projection image for all (x,y,z) points. This can be achieved by using the <a href="https://en.wikipedia.org/wiki/Spherical_coordinate_system">spherical coordinate system</a>. Looking at the above figure, we can see that if the +ive x-axis is the front view of the lidar, then each point of the cloud will make an inclination <em>angle</em><strong>, <em>pitch </em></strong>with the xy plane and <em>angle</em><strong><em>, yaw </em></strong>with the xz axis. Here we want to project the hollow cylinder onto the zy plane to form the image. By employing basic trigonometry, we can get the value of pitch and yaw for each point. As the origin is at the center of the image, these yaw and pitch values make up each pixel position of the projection image. Thus, by calculating the yaw and pitch for each point, we can completely form the projection image. At this point I would also like to point out, the value of pitch will range from [FOV_Up , FOV_Down] as it is max and min angle pointed by the lasers and the value of yaw will range from [-pi, pi] as that is the range given by atan2 function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*dlW9j28n2ak83NXB94xaHA.png" /></figure><p>Although we now have a projection image, we still cannot use it due to two problems. First, we need to translate the origin to the top left corner of the image as shown below. This is because, in computer vision, the norm is to have the origin at the top left corner of the image. Second, we need to scale the image depending upon the type of lidar being used. Both of these steps are shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RQ54xCRVudI39TaF4hAg_Q.png" /><figcaption>(Author: Anirudh Topiwala)</figcaption></figure><h4>1. Translating the Origin</h4><p>This is a simple translation of origin problem. Looking at the above figure, we can move the origin to the left edge of the image by adding an angle of pi to the yaw axis, whereas the origin is moved to the top of the image by subtracting pitch angle from FOV_Up. Thus the new equations become:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*WHPRhG1tlM0K9dNOz5SgJQ.png" /></figure><h4>2. Normalizing and Scaling</h4><blockquote>This step is necessary as size of the projection image will vary for different types of lidar with the prime objective being to fit as many points as possible in the projection image.</blockquote><p>As we have observed throughout this blog post that this whole process is about dimensionality reduction and therefore, its a fact that we will loose data. The idea here is to form the image dimensions in such a way that we are able to capture the most relevant points from the cloud in the image. Therefore, we can logically see that the <strong>number of lasers of the lidar should be equivalent to the width of the projection image</strong>. This way each row of the image will relate to points obtained from each laser of the lidar. This value is called the row_scale factor and is multiplied to the normalized pitch axis. For example, a<a href="https://velodynelidar.com/products/hdl-64e/"> Velodyne HDL 64-E lidar</a> has 64 lasers and therefore, the width of the projection image should be set to 64 by multiplying this value to the pitch axis.</p><p><strong>The length of the image makes up the angular resolution in yaw. This parameter can be tuned to fit as many points as possible</strong>. This length of the image is also called the col_scale and is multiplied to the normalized yaw axis to get the final image dimensions. Again, in the case of HDL 64-E, the max horizontal resolution is 0.35 degrees. Therefore in the worst case, we will at least get (360/0.35 = 1028) points per laser. In deep learning and for convolution networks, image sizes are preferred to be powers of 2. Therefore, a length of 1024 would fit maximum number of points in the image and we will multiply this value to yaw axis.</p><p>Therefore, the image dimensions of 64X1024 are ideal for HDL 64-E. A similar calculation can be made for <a href="http://velodynelidar/">Velodyne VLP-16</a> where the best image dimensions come out to be 16x1024.</p><p>The normalizing equation can now be rewritten as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3tWawCiH6jrlqccNAApzsg.png" /></figure><p>if the overall FOV = FOV_Up + abs(FOV_Down), then the final equations for (u,v) with some rearrangement of values can be written as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JZCurin1q7ZOF1t7IJw4DA.png" /></figure><p>and for Velodyne HDL 64-E lidar, the same equations can be rewritten as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uk9j7Xa_TBWZw58rnNH5Aw.png" /></figure><blockquote>Thus, with the help of the above equations, we can project each point (x,y,z) of the cloud into its corresponding spherical projection (u,v).</blockquote><h3>Encoding Point Information into the Image</h3><p>Once we have the (u,v) pixel for each point of the cloud, we need to round it to get the nearest integer and encode point information into it. Usually, 5 key values are added at each pixel and that is X, Y, Z , R and I. Here, (X, Y, Z) are the coordinates of the point, R is the euclidean distance or range of that point from the lidar and I is the intensity. Range is the only value that we calculate, as X,Y,Z and I values are already present for each point of the cloud formed by the lidar. Therefore, the final image dimensions we get are:</p><blockquote><strong>dimension of image = Num of lasers of lidar * Length of the projection image * 5 (the five channels are X,Y,Z,R,I)</strong></blockquote><h3>Now the Part you have been waiting for.. Results!!!</h3><p>Using the equations derived above, I have written a c++ code which can be found <a href="https://github.com/anirudhtopiwala/OpenSource_Problems">here</a>. This code uses <a href="http://pointclouds.org/">PCL </a>library to load the point cloud and <a href="https://opencv.org/">openCV </a>to visualize each dimension of the Spherical Image formed. To test my implementation, I have used dataset from <a href="http://semantic-kitti.org/">SemanticKitti</a>. The upper part of the gif below shows the intensity values for the spherical image formed from the point cloud shown in the lower part.</p><blockquote>To recap, as the lidar used in this dataset is velodyne HDL 64-E, the dimensions of the Spherical image formed is 64 * 1024* 5.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*b-kIpWiYhDt91Tky2tI1MQ.gif" /><figcaption>The Upper part is the intensity dimension of the Spherical Image formed and the lower part is the input point cloud. (Author: Anirudh Topiwala)</figcaption></figure><h4>Some key observations:</h4><blockquote>1. Each row of the spherical image corresponds to points obtained from each laser of the lidar. Here, the lowest row in the image corresponds to the lowest laser in lidar which is the closest ring near the lidar as seen in the gif above.</blockquote><blockquote>2. The spherical image formed is circular in nature, meaning you would be able to observe that when objects leave the image from the left side, they might reappear on the right side of the image.</blockquote><blockquote>3. The objects in the image can be identified with the human eye. Meaning, if you look at the image, it is easy to distinguish cars, cycles, buildings, road and so on. And if it is distinguishable with the human eye, then there is a really good chance that a deep network trained on such images is able to give good segmentation and classification results.</blockquote><blockquote>4. The points lost in this projection are those which have the same pitch and yaw angles with the lidar center but different range values. So, only one of the points on the ray connecting the lidar center to that point would be captured in the projection image.</blockquote><p>A clear video of the result can be found <a href="https://www.youtube.com/watch?v=1vSI_j435Vs">here.</a></p><h4>To conclude, spherical projection is a very powerful tool to represent point cloud data in image form. Using it can help us extend all the research done over the last decade in image space to point cloud data and therefore has varied applications in the realms of Robotics and Autonomous vehicles.</h4><p>I am open to any suggestions or brain storming sessions for this topic as well as other topics in the realms of computer vision and deep learning, so please feel free to <a href="https://anirudhtopiwala.com/">contact me!!!</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56a2fc258e6c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/spherical-projection-for-point-clouds-56a2fc258e6c">Spherical Projection for Point Clouds</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>