<?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 Duncan on Medium]]></title>
        <description><![CDATA[Stories by Duncan on Medium]]></description>
        <link>https://medium.com/@duncan.dev?source=rss-eccc93490d3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mvfeNWHNslVTiqGaaOic2A.jpeg</url>
            <title>Stories by Duncan on Medium</title>
            <link>https://medium.com/@duncan.dev?source=rss-eccc93490d3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 02:23:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@duncan.dev/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[ELI5: The Building Blocks of Computer Vision]]></title>
            <link>https://medium.com/@duncan.dev/eli5-the-building-blocks-of-computer-vision-dcbd5aff1fd5?source=rss-eccc93490d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcbd5aff1fd5</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Duncan]]></dc:creator>
            <pubDate>Sat, 16 Aug 2025 07:59:27 GMT</pubDate>
            <atom:updated>2025-08-16T12:22:21.548Z</atom:updated>
            <content:encoded><![CDATA[<p>LLMs are hogging all the spotlight in AI these days, like the popular kid at school who has just got their driver’s license. But while everyone is busy fawning over chatbots, computer vision has been quietly powering your phone’s face unlock, reading medical scans, and helping cars not crash into things. It deserves a little love too. So here’s a quick, ELI5-style tour of the fundamentals — snackable bites to help you get started and maybe even see the field a little differently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yWOMENbhDxaR6jKgawVtRg.png" /></figure><p>Outline:</p><ol><li>Introduction to images</li><li>Image Processing</li><li>Feature Detection and Description</li><li>Image Segmentation and Shape Detection</li><li>Image Alignment and Transformation</li><li>Motion Analysis and Tracking</li><li>Neural Networks</li></ol><h3>1. Introduction to Images</h3><p>Ever wondered how computers “see” images? Here’s the thing: they don’t actually see the way we do. When you look at a photo of your dog, you instantly recognise fluffy ears, a wet nose, maybe that guilty expression that says “I definitely didn’t eat your sandwich.” But computers? They see numbers. Lots and lots of numbers.</p><p>Think of an image like a giant spreadsheet where each cell contains a number that represents a pixel’s colour. Most images are actually stored as 3D grids — imagine a stack of three spreadsheets on top of each other. The first two dimensions tell us where each pixel lives (its height and width position), and the third dimension is all about colour.</p><p>The most common way computers represent colour is RGB — Red, Green, and Blue. It’s like having three paint buckets, and each pixel’s colour is created by mixing different amounts from each bucket. Each colour can have values from 0 to 255, which gives us about 16.7 million possible colours. Not bad for three buckets of paint, right?</p><h3>2. Image Processing</h3><p>Now that we know images are just organised collections of numbers, here’s where it gets fun: we can mess with those numbers to change how images look. It’s like having Photoshop, but at the most basic level.</p><h4>2.1 Image Processing and Linear Filtering</h4><p>Let’s start with something called pointwise processing. Fancy name, simple concept: we take each pixel and do some math to it. Want to make an image brighter? Add the same number to every pixel. Want more contrast? Multiply each pixel by some factor. It’s like turning the brightness knob on your TV, except we’re doing it pixel by pixel.</p><p>But sometimes you want to get a bit more sophisticated. That’s where linear filtering comes in. Instead of just looking at one pixel at a time, we look at a pixel and all its neighbours, kind of like considering what the whole neighbourhood is like before deciding how to change one house. Blurring and sharpening both work this way — they’re essentially different ways of asking “what should this pixel look like based on what’s happening around it?”</p><h4>2.2 Gradients and Edges</h4><p>Here’s where things get interesting. Imagine you’re walking through a city and suddenly you hit the edge of a building — there’s a sharp change from “building” to “sky.” In computer vision, we call these sharp changes <strong>edges</strong>, and they’re incredibly useful because they tell us where one object ends and another begins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/0*CJfup9Repv4oNLZw.png" /></figure><p><strong>Gradients</strong> are like little arrows that point toward the biggest changes in brightness. Think of them as the computer’s way of saying “hey, something important is happening over there!” These gradients help us find edges, which is why techniques like Canny Edge Detection are so powerful — they’re essentially really good at finding the outlines of objects in images.</p><h3>3. Feature Detection and Description</h3><p>So what exactly is a “feature” in computer vision? It’s basically any distinctive pattern that we can describe mathematically. Think of it like this: if you were trying to describe your friend’s face to someone who’s never met them, you might mention their distinctive eyebrows or that little scar above their left eye. Features are the computer’s version of those distinctive characteristics.</p><h4>3.1 Keypoints and Descriptors</h4><p>This brings us to keypoints and descriptors, which work as a team. <strong>Keypoints</strong> are like the computer pointing and saying, “This spot right here is special” — maybe it’s a corner, an intersection, or just something that stands out. <strong>Descriptors</strong> are the computer’s way of actually describing what makes that spot special.</p><p>Here’s my favourite way to think about this: imagine you’re building a Lego castle and want to describe it to someone over the phone. You might say, “There’s a red square door at the bottom left corner”, or “On top of that, there are two long blue bricks that look like flags.” The castle is your whole image, those important parts (the door, the flags) are your keypoints, and the way you describe each part — colour, shape, size — those are your descriptors.</p><p>Some famous examples you might have heard of are <a href="https://medium.com/@deepanshut041/introduction-to-harris-corner-detector-32a88850b3f6">Harris Corners</a> (great at finding corner-like features that stay consistent even when you rotate or move the image) and <a href="https://medium.com/@deepanshut041/introduction-to-sift-scale-invariant-feature-transform-65d7f3a72d40">SIFT</a> and <a href="https://medium.com/@deepanshut041/introduction-to-surf-speeded-up-robust-features-c7396d6e7c4e">SURF</a> (which are particularly good at creating descriptors that work across different lighting conditions).</p><h4>3.2 Visual Textures</h4><p>Then there’s texture, which is basically about recognising patterns. You know how you can instantly tell the difference between a brick wall, a sandy beach, and tree bark just by looking at them? That’s texture recognition at work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/0*sityNUw4ySZniLeE.png" /></figure><p>In computer vision, we break this down into something called <strong>textons</strong> — think of them as the fundamental building blocks of texture, like the atoms of visual patterns. Understanding textures helps computers recognise not just what objects are in an image, but what they’re made of, which is incredibly useful for everything from medical imaging to quality control in manufacturing.</p><h3>4. Image Segmentation and Shape Detection</h3><p>Here’s where computer vision gets really practical. Image segmentation is like taking a jigsaw puzzle and figuring out which pieces belong together. In medical imaging, this might mean identifying tumour tissue in an MRI scan. In autonomous driving, it could mean separating the road from the sidewalk from the cars.</p><h4>4.1 Lines and Hough Transform</h4><p>Let’s talk about finding shapes, starting with the simplest one: straight lines. You’d think this would be easy, right? But here’s the catch: edge detectors like Canny give us lots of edge points, but they don’t tell us which points form lines together.</p><p>Enter the <strong>Hough Transform</strong>, which is honestly one of the cleverest tricks in computer vision. Instead of looking at the image directly, it flips the problem around and asks, “If there were a line here, what would it look like?” It’s like playing twenty questions with geometry, and it’s remarkably good at finding lines, circles, and other shapes even when the image is noisy or partially obscured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/0*-wLo8sq2hoH6rwlo.JPG" /></figure><h4>4.2 Image Segmentation</h4><p>Now for the actual segmentation algorithms, which have wonderfully intuitive names that describe what they do:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/0*uAOjFRpPPnivY8V8.jpg" /></figure><p><a href="https://www.naftaliharris.com/blog/visualizing-k-means-clustering/">K-Means Clustering</a> groups pixels into clusters by repeatedly finding the “average” colour of each group and reassigning pixels to their closest match — imagine sorting a bag of mixed candies by colour, where you keep refining your piles until each candy is with its most similar neighbours.</p><p><a href="https://www.youtube.com/watch?v=yFIlIuLO6fw">SLIC Superpixels</a> takes this idea further by considering both colour and location, creating small patches of similar pixels that stick together like puzzle pieces.</p><p><a href="https://www.youtube.com/watch?v=dRVO6GIMAhc">Mean-Shift Clustering</a> works like a magnet for similar colours and intensities, where pixels naturally gravitate toward regions with similar characteristics until distinct segments emerge.</p><h3>5. Image Transformation and Homography</h3><p>Sometimes we need to play with perspective — imagine taking two photos of the same building from different angles and trying to make them look like they were shot from the same spot. That’s where image transformation comes in, and it’s like having a digital toolbox for repositioning and reshaping images.</p><h4>5.1 Homography</h4><p>Think of homography as a mathematical recipe that tells us how to stretch, squash, and skew one image to match another — like trying to match up two photos of the same building taken from different angles so they look like they were shot from the exact same spot!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*CarbS8KPWaaL6eEi.gif" /></figure><h4>5.1.1 Normalised Direct Linear Transform (DLT)</h4><p>The <strong>Normalised Direct Linear Transform</strong> sounds intimidating, but it’s really just our go-to method for finding that recipe when we have matching points between two images. Here’s the clever part: DLT takes our messy pixel coordinates and gives them a mathematical makeover first (normalisation), which makes everything much more stable and accurate. Then it plays detective, reverse-engineering the transformation from the clues we have.</p><h4>5.1.2 <a href="https://scikit-learn.org/stable/auto_examples/linear_model/plot_ransac.html">Random Sample Consensus (RANSAC)</a></h4><p>But here’s where things get tricky: real-world data is noisy, and sometimes we have outliers (those pesky incorrect matches that throw everything off). Enter RANSAC (Random Sample Consensus), our statistical superhero that repeatedly picks small subsets of points, computes a homography, and tests how well it works with all the other points. RANSAC essentially plays a game of “which homography gets the most votes?” and picks the winner, effectively filtering out the troublemakers and giving us a robust solution even when our data isn’t perfect.</p><h4>5.2 Image Warping</h4><p>Once we have our homography matrix, we can perform image warping — essentially reshaping one image to align with another, like digitally stretching a rubber sheet to match a specific pattern. The process involves taking each pixel from the source image and calculating where it should land in the destination image using our homography transformation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/0*gtciqMrwAi6BccIH.png" /></figure><h3>6. Motion Analysis and Tracking</h3><p>Now we’re getting into video territory! A video is just a series of related images (frames) where the action unfolds over time. But here’s where things get interesting — we want to understand how things move and change across those frames.</p><h4>6.1 Optical Flow</h4><p><strong>Optical flow</strong> is like having superhuman eyes that can track the movement of every single pixel from one frame to the next. Remember those flipbooks you made as a kid, where you’d draw a stick figure on each page and flip through to make it “move”? Optical flow is like being able to track every single line in that stick figure as it moves across the pages.</p><p>This is incredibly useful for understanding motion in videos. Techniques like <strong>Lucas-Kanade</strong> and <strong>Horn-Schunck</strong> are like different flavours of the same basic idea: following pixels as they dance across frames.</p><h4>6.2 Tracking</h4><p><strong>Tracking</strong> is optical flow’s more focused cousin. While optical flow tries to track every pixel, tracking says, “I only care about this one specific thing.” Going back to that flipbook analogy — imagine it’s a “Where’s Wally” flipbook where Wally gradually moves across each page. Tracking is like having a tool that helps you easily spot Wally on every page, no matter where he wanders off to.</p><p>The <strong>Kanade-Lucas-Tomasi (KLT) Tracker</strong> is one of the classic ways to do this, and it’s surprisingly robust at keeping track of objects even when they partially disappear or change appearance slightly.</p><h3>7. Neural Networks</h3><p>By now, we’ve seen how computers can detect edges, align images, and even follow Wally across frames. But here’s the catch: many of these classical techniques work best when the world is neat and structured. Real-world images, however, are wonderfully messy — think of a crowded street, a blurry night photo, or a cat that insists on sitting inside a cardboard box (because of course it does).</p><p>This is where <strong>neural networks</strong> step in like the Swiss Army knife of computer vision.</p><h4>7.1 Convolutional Neural Networks</h4><p>The most common type in computer vision is the <strong>Convolutional Neural Network (CNN)</strong>. Unlike the fully connected neural networks you may have seen in introductory AI tutorials, CNNs are designed specifically to handle image data. Instead of connecting every pixel to every neuron (which would be computationally impossible for large images), CNNs use small sliding filters — convolutions — that scan across the image to detect local patterns. These filters might capture simple features like edges or corners at first, and then, deeper in the network, more complex patterns like textures, shapes, or even faces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AgulnHOWNoxXxSo8.gif" /></figure><p>So what are CNNs used for? Pretty much everything in modern computer vision: image classification (is this a cat or a dog?), object detection (where is the cat?), and segmentation (which pixels belong to the cat?). CNNs learn hierarchies of features automatically, which means we do not need to handcraft descriptors like SIFT or SURF anymore — the network figures them out for us.</p><p>One clever trick CNNs use is <strong>pooling</strong>, especially <strong>max pooling</strong>. Pooling layers reduce the spatial size of the feature maps, which does two things: (1) it makes computations faster, and (2) it makes the model more robust to small shifts in the image. For example, if your cat moves a few pixels to the left, max pooling helps the network recognise it is still the same cat. Max pooling works by taking the maximum value from a small region (say, a 2×2 block), effectively keeping the most important signal while discarding the less relevant details. This ability to preserve essential features while ignoring small variations is one reason CNNs have been so effective in vision tasks.</p><p>In essence, CNNs gave computer vision a massive upgrade. Instead of us having to tell the computer exactly what to look for, we just show it lots of examples and let it figure out the patterns. And as we’ve gotten better datasets and more computing power, CNNs have become the backbone of almost every modern vision system — from the app that identifies plants in your garden to the systems helping doctors spot diseases in medical scans.</p><p>And there you have it — a whirlwind tour of computer vision fundamentals, served up in bite-sized, hopefully digestible pieces 😆. While LLMs might be getting all the attention right now, remember that computer vision has been quietly making our lives better for years, and it’s only getting more interesting from here.</p><h3>References</h3><ul><li><a href="https://medium.com/data-science/canny-edge-detection-step-by-step-in-python-computer-vision-b49c3a2d8123">https://medium.com/data-science/canny-edge-detection-step-by-step-in-python-computer-vision-b49c3a2d8123</a></li><li><a href="https://www.analyticsvidhya.com/blog/2022/06/a-complete-guide-on-hough-transform/">https://www.analyticsvidhya.com/blog/2022/06/a-complete-guide-on-hough-transform/</a></li><li><a href="https://modal.com/_app/immutable/assets/image-segmentation.U3DNXBYd.jpg">https://modal.com/_app/immutable/assets/image-segmentation.U3DNXBYd.jpg</a></li><li><a href="https://raw.githubusercontent.com/wiki/hecomi/uHomography/image.gif">https://raw.githubusercontent.com/wiki/hecomi/uHomography/image.gif</a></li><li><a href="https://scikit-learn.org/stable/auto_examples/linear_model/plot_ransac.html">https://scikit-learn.org/stable/auto_examples/linear_model/plot_ransac.html</a></li><li><a href="https://stackoverflow.com/questions/34884779/whats-a-simple-way-of-warping-an-image-with-a-given-set-of-points">https://stackoverflow.com/questions/34884779/whats-a-simple-way-of-warping-an-image-with-a-given-set-of-points</a></li><li><a href="https://medium.com/data-science/intuitively-understanding-convolutions-for-deep-learning-1f6f42faee1">https://medium.com/data-science/intuitively-understanding-convolutions-for-deep-learning-1f6f42faee1</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcbd5aff1fd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>