Close Menu
    Facebook LinkedIn YouTube WhatsApp X (Twitter) Pinterest
    Trending
    • Hisense U7SG TV Review (2026): Better Design, Great Value
    • Google is in talks with Marvell Technology to develop a memory processing unit that works alongside TPUs, and a new TPU for running AI models (Qianer Liu/The Information)
    • Premier League Soccer: Stream Man City vs. Arsenal From Anywhere Live
    • Dreaming in Cubes | Towards Data Science
    • Onda tiny house flips layout to fit three bedrooms and two bathrooms
    • Best Meta Glasses (2026): Ray-Ban, Oakley, AR
    • At the Beijing half-marathon, several humanoid robots beat human winners by 10+ minutes; a robot made by Honor beat the human world record held by Jacob Kiplimo (Reuters)
    • 1000xResist Studio’s Next Indie Game Asks: Can You Convince an AI It Isn’t Human?
    Facebook LinkedIn WhatsApp
    Times FeaturedTimes Featured
    Sunday, April 19
    • Home
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    • More
      • AI
      • Robotics
      • Industries
      • Global
    Times FeaturedTimes Featured
    Home»Artificial Intelligence»Feature Detection, Part 3: Harris Corner Detection
    Artificial Intelligence

    Feature Detection, Part 3: Harris Corner Detection

    Editor Times FeaturedBy Editor Times FeaturedJanuary 5, 2026No Comments8 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr WhatsApp Email
    Share
    Facebook Twitter LinkedIn Pinterest Telegram Email WhatsApp Copy Link


    Characteristic detection is a site of pc imaginative and prescient that focuses on utilizing instruments to detect areas of curiosity in photos. A major facet of most function detection algorithms is that they don’t make use of machine studying below the hood, making the outcomes extra interpretable and even sooner in some instances.

    Within the earlier two articles of this collection, we checked out the most well-liked operators for detecting picture edges: Sobel, Scharr, Laplacian, along with the Gaussian used for picture smoothing. In some type or one other, these operators used under-the-hood picture derivatives and gradients, represented by convolutional kernels.

    As with edges, in picture evaluation, one other kind of native area is commonly explored: corners. Corners seem extra hardly ever than edges and normally point out a change of border route of an object or the top of 1 object and the start of one other one. Corners are rarer to seek out, and so they present extra helpful data.

    Instance

    Think about you’re accumulating a 2D puzzle. What most individuals do firstly is discover a piece with a picture half containing the border (edge) of an object. Why? As a result of this manner, it’s simpler to establish adjoining items, for the reason that variety of items sharing the same object edge is minimal.

    We are able to go even additional and concentrate on selecting not edges however corners — a area the place an object modifications its edge route. These items are even rarer than simply edges and permit for a fair simpler seek for different adjoining fragments due to their distinctive type.

    For instance, within the puzzle beneath, there are 6 edges (B2, B3, B4, D2, D3, and D4) and just one nook (C5). By selecting the nook from the beginning, it turns into simpler to localize its place as a result of it’s rarer than edges.

    The objective of this text is to know how corners will be detected. To try this, we are going to perceive the main points of the Harris nook detection algorithm – one of many easiest and standard strategies developed in 1988.

    Thought

    Allow us to take three sorts of areas: flat, edge, and nook. We have now already proven the construction of those areas above. Our goal might be to know the distribution of gradients throughout these three instances.

    Throughout our evaluation, we may even construct an ellipse that accommodates nearly all of the plotted factors. As we are going to see, its type will present sturdy indications of the kind of area we’re coping with.

    Flat area

    A flat area is the only case. Normally, the complete picture area has practically the identical depth values, making the gradient values throughout the X and Y axes minor and centered round 0.

    By taking the gradient factors (Gₓ, Gᵧ) from the flat picture instance above, we will plot their distribution, which seems to be like beneath:

    We are able to now assemble an ellipse across the plotted factors having a middle at (0, 0). Then we will establish its two principal axes:

    • The main axis alongside which the ellipse is maximally stretched.
    • The minor axis alongside which the ellipse attains its minimal extent.

    Within the case of the flat area, it may be troublesome to visually differentiate between the main and minor axes, because the ellipse tends to have a round form, as in our state of affairs.

    However, for every of the 2 principal axes, we will then calculate the ellipse radiuses λ₁ and λ₂. As proven within the image above, they’re nearly equal and have small relative values.

    Edge area

    For the sting area, the depth modifications solely within the edge zone. Outdoors of the sting, the depth stays practically the identical. On condition that, a lot of the gradient factors are nonetheless centered round (0, 0).

    Nevertheless, for a small half across the edge zone, gradient values can drastically change in each instructions. From the picture instance above, the sting is diagonal, and we will see modifications in each instructions. Thus, the gradient distribution is skewed within the diagonal route as proven beneath:

    For edge areas, the plotted ellipse is often skewed in the direction of one route and has very completely different radiuses λ₁ and λ₂.

    Nook area

    For corners, a lot of the depth values exterior the corners keep the identical; thus, the distribution for almost all of the factors remains to be positioned close to the middle (0, 0).

    If we take a look at the nook construction, we will roughly consider it as an intersection of two edges having two completely different instructions. For edges, we now have already mentioned within the earlier part that the distribution goes in the identical route both in X or Y, or each instructions.

    By having two edges for the nook, we find yourself with two completely different level spectrums rising in two completely different instructions from the middle. An instance is proven beneath.

    Lastly, if we assemble an ellipse round that distribution, we are going to discover that it’s bigger than within the flat and edge instances. We are able to differentiate this outcome by measuring λ₁ and λ₂, which on this state of affairs will take a lot bigger values.

    Visualization

    We have now simply seen three eventualities during which λ took completely different values. To higher visualize outcomes, we will assemble a diagram beneath:

    Diagram exhibiting the connection between values of λ and area sorts.

    Formulation

    To have the ability to classify a area into one in every of three zones, a method beneath is often used to estimate the R coefficient:

    R = λ₁ ⋅ λ₂ – ok ⋅ (λ₁ + λ₂)² , the place 0.04 ≤ ok ≤ 0.06

    Based mostly on the R worth, we will classify the picture area:

    • R < 0 – edge area
    • R ~ 0 – flat area
    • R > 0 – nook area

    OpenCV

    Harris Nook detection will be simply applied in OpenCV utilizing the cv2.CornerHarris operate. Let’s see within the instance beneath how it may be carried out.

    Right here is the enter picture with which we might be working:

    Enter picture

    First, allow us to import the required libraries.

    import numpy as np
    import cv2
    import matplotlib.pyplot as plt

    We’re going to convert the enter picture to grayscale format, because the Harris detector works with pixel intensities. Additionally it is essential to convert the picture format to float32, as computed values related to pixels can exceed the bounds [0, 255].

    path = 'information/enter/shapes.png'
    picture = cv2.imread(path)
    grayscale_image = cv2.cvtColor(picture, cv2.COLOR_BGR2GRAY)
    grayscale_image = np.float32(grayscale_image)

    Now we will apply the Harris filter. The cv2.cornerHarris operate takes 4 parameters:

    • grayscale_image – enter grayscale picture within the float32 format.
    • blockSize (= 2) – defines the size of the pixel block within the neighborhood of the goal pixel thought-about for nook detection.
    • ksize (= 3) – the dimension of the Sobel filter used to calculate derivatives.
    • ok (= 0.04) – coefficient within the method used to compute the worth of R.
    R = cv2.cornerHarris(grayscale_image, 2, 3, 0.04)
    R = cv2.dilate(R, None)

    The cv2.cornerHarris operate returns a matrix of the precise dimensions as the unique grayscale picture. Its values will be effectively exterior the traditional vary [0, 255]. For each pixel, that matrix accommodates the R coefficient worth we checked out above.

    The cv2.dilate is a morphological operator that may optionally be used instantly after to higher visually group the native corners.

    A typical approach is to outline a threshold beneath which pixels are thought-about corners. For example, we will contemplate all picture pixels as corners whose R worth is bigger than the maximal international R worth divided by 100. In our instance, we assign such pixels to crimson coloration (0, 0, 255).

    To visualise a picture, we have to convert it to RGB format.

    picture[R > 0.01 * R.max()] = [0, 0, 255]
    image_rgb = cv2.cvtColor(picture, cv2.COLOR_BGR2RGB)

    Lastly, we use maplotlib to show the output picture.

    plt.determine(figsize=(10, 8))
    plt.imshow(image_rgb)
    plt.title('Harris Nook Detection')
    plt.axis('off')
    plt.tight_layout()
    plt.present()

    Right here is the outcome:

    Output picture. Purple coloration signifies corners.

    Conclusion

    On this article, we now have examined a strong methodology for figuring out whether or not a picture area is a nook. The offered method for estimating the R coefficient works effectively within the overwhelming majority of instances. 

    In actual life, there’s a frequent must run an edge classifier for a whole picture. Establishing an ellipse across the gradient factors and estimating the R coefficient every time is resource-intensive, so extra superior optimization strategies are used to hurry up the method. However, they’re primarily based so much on the instinct we studied right here.

    Sources

    All photos until in any other case famous are by the creator.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Editor Times Featured
    • Website

    Related Posts

    Dreaming in Cubes | Towards Data Science

    April 19, 2026

    AI Agents Need Their Own Desk, and Git Worktrees Give Them One

    April 18, 2026

    Your RAG System Retrieves the Right Data — But Still Produces Wrong Answers. Here’s Why (and How to Fix It).

    April 18, 2026

    Europe Warns of a Next-Gen Cyber Threat

    April 18, 2026

    How to Learn Python for Data Science Fast in 2026 (Without Wasting Time)

    April 18, 2026

    A Practical Guide to Memory for Autonomous LLM Agents

    April 17, 2026

    Comments are closed.

    Editors Picks

    Hisense U7SG TV Review (2026): Better Design, Great Value

    April 19, 2026

    Google is in talks with Marvell Technology to develop a memory processing unit that works alongside TPUs, and a new TPU for running AI models (Qianer Liu/The Information)

    April 19, 2026

    Premier League Soccer: Stream Man City vs. Arsenal From Anywhere Live

    April 19, 2026

    Dreaming in Cubes | Towards Data Science

    April 19, 2026
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    About Us
    About Us

    Welcome to Times Featured, an AI-driven entrepreneurship growth engine that is transforming the future of work, bridging the digital divide and encouraging younger community inclusion in the 4th Industrial Revolution, and nurturing new market leaders.

    Empowering the growth of profiles, leaders, entrepreneurs businesses, and startups on international landscape.

    Asia-Middle East-Europe-North America-Australia-Africa

    Facebook LinkedIn WhatsApp
    Featured Picks

    Cut the cupcakes: how to avoid corporate takeover of International Women’s Day

    February 12, 2026

    Best Places to Buy Contact Lenses Online for 2025

    February 1, 2025

    Startup 360: Georgie Healy on AI hacks, tuning out of tech and keeping up with the models

    February 20, 2026
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    Copyright © 2024 Timesfeatured.com IP Limited. All Rights.
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us

    Type above and press Enter to search. Press Esc to cancel.