GPU Image correlation

GPU Image correlation

Hi there. Long time without posting anything =)

I'm back with a very cool python lib / script to find differences between images. I was spending some spare time learning parallel computing so I decided to put my hand at work with in some interesting exercise, why not doing some simple image processing.

So, going straight to the point, here is the repo:

https://github.com/blasvicco/gpu-image-corr

You will find there a complete description of the library but here a short summary of what it does.

Let's say we have two images of the same size that are similar, like these ones:

No alt text provided for this image
No alt text provided for this image

I know you noticed some differences, but some of them are very difficult to spot. For that, here come a very powerful method from signal processing to help us. Of course I'm talking about the correlation coefficient between two vectors. I will not bore you with much detail about it but I leave you a couple of links where you can find cool explanations:

So, coming back to our problem, we can just correlate our images but that will not give us much detail about which one or where are the differences. For that, a very intuitive approach, it's to use sliding window technique for image processing. What?! Here a link with a very short video I found on internet that explain it just perfectly:

Basically, we will compare smaller portion of NxN pixels of the images. In our case, I will not overlap the frames for simplicity, so we will end up with a map of correlation coefficients in the coordinates where the frame came from the image. In other words, we will have a frame size precision of where we detect a difference.

It is cool to develop this tool using the CPU, but it is outstanding doing it using the GPU and parallelizing the correlation of each frame. That will increase the speed in a fantastic way. So, in order to see the GPU in action I created this lib that you can test using https://colab.research.google.com/

Give it a try to have fun. It is a 2' setup! Check the repo to know how and find out the difference between this two Marios and Luigis!

To view or add a comment, sign in

More articles by Blas Vicco

  • I Built an AI-Augmented Engineering System So My Team Could Spend More Time on Judgment, Not Friction

    What would an engineering team look like if AI handled everything except the decisions that actually require human…

    2 Comments
  • GID Problem Type for Steady State Heat Transfer 2D

    Hi fellows, this time I bring you an awesome project I developed with a didactic purpose to help anyone in the engineer…

  • ReactJS + SVG Files Component

    Hi there! Today I will present this awesome React component that will allow us to include any SVG file via Ajax and…

  • NodeJS + Pipeline Pattern Design

    Hello there, Today I will explain an implementation of Pipeline Pattern Design using Promise and OOP for NodeJS. The…

  • Drupal 8 + Search API Solr + Performance

    Hi there, for those who are struggling with the module Search API Solr in Views, here I'm leaving an extension of the…

  • Deep Learning in a Simple XOR Problem

    Introduction: The most wonderful gift that my parents gave me was that from the very beginning they made me a reader. I…

  • TinyBoss

    Check this simple example of AI (artificial intelligence) on microorganism game. This video is about TinyBoss, a…

Others also viewed

Explore content categories