!!Con 2022 - How to look for one image inside another image, fast! by Omar Rizwan

Channel:
Subscribers:
42,400
Published on ● Video Link: https://www.youtube.com/watch?v=fH6yjw_PlEU



Category:
Guide
Duration: 9:34
172 views
7


How to look for one image inside another image, fast!

You know about regular expressions and string matching? Well, what about image matching? How would you look for images inside other images? One way that you might do it is to loop through each position in image A and at each of those positions, check how much the area around it looks like image B, so you can build a ‘heat map’ of which regions of image A look like image B. But that’s really slow if image B is more than a few pixels big, since you need to do (number of pixels in A) * (number of pixels in B) iterations…

I was trying to do this for a new project/interface experiment – a daemon that continuously watches your screen for image patterns that you tell it to look for – and I found out that this task is called template matching, and you can do it way faster. The OpenCV library can do this all in tens of milliseconds, as opposed to the several seconds that the nested-loop approach took for me. So I wanted to know how OpenCV does it, and how I could get rid of the dependency and do it myself!

We’ll talk about Apple’s Accelerate library, convolution, the Fourier transform, summed-area tables, and why you need to use doubles sometimes instead of floats, among other things. In the end, I got to make the same jump, from seconds down to milliseconds (arguably, I’m even faster than OpenCV now, at least for what i want to do!) – and the whole thing is basically one self-contained C file.

Omar is interested in new ways to interact with (and program) computers. He previously worked as a researcher at Dynamicland; he’s also the creator of TabFS, Screenotate, Breakout-in-a-PDF, and a variety of other strange computer projects.




Other Videos By Confreaks


2023-08-04PowerShell Summit 2023: Keynote - More than two decades in shell and ops by Brendan Burns
2023-08-04PowerShell Summit 2023: Amazing feats of the Abstract Syntax Tree by James Brundage
2023-08-04PowerShell Summit 2023: Optimizing Visual Studio Code for PowerShell, 2023 Edition by Justin Grote
2023-08-04PowerShell Summit 2023: State of the Shell by PowerShell Team
2023-08-04PowerShell Summit 2023 - Welcome message by James Petty and Heidi Erpelding Welch
2023-08-04PowerShell Summit 2023: Documentation is UX! - Change my mind by Glenn Sarti
2023-08-04PowerShell Summit 2023: Best practices for automating Azure with PowerShell... by Aleksandar Nikolic
2023-08-04PowerShell Summit 2023: Anthony's Favorite dbatools cmdlets and Use Cases by Anthony Nocentino
2023-08-04PowerShell Summit 2023: Coding with the lights ON - OpenTelemetry from code to prod by Roni Dover
2023-03-29!!Con 2022 - Shhh, Meet Me at Midnight!!! (Audio Steganography in Python) by Marlene Mhangami
2023-03-29!!Con 2022 - How to look for one image inside another image, fast! by Omar Rizwan
2023-03-29!!Con 2022 Comedy Routine by Sumana Harihareswara
2023-03-29!!Con 2022 - You Kiss Your Computer With That Mouth?! by Nicole He
2023-03-29!!Con 2022 - Building A Better Tech Future!! by Aniyia Williams
2023-03-29!!Con 2022 - Let’s code in our mother tongue! by Anuloluwapo Karounwi
2023-03-29!!Con 2022 - Taperipper or, Oops! All SCSI! by Aki Van Ness
2023-03-29!!Con 2022 - Code readability isn’t just about personal preference! by Ashlee Boyer
2023-03-29!!Con 2022 - Customizable Icons With Font Technologies! by Wenting Zhang
2023-03-07RubyConf 2022: Using JRuby: What, When, How, and Why by Charles Nutter
2023-03-07RubyConf 2022: Analyzing an analyzer - A dive into how RuboCop works by Kyle d'Oliveira
2023-03-07RubyConf 2022: Solidarity not Charity and Collective Liberation by Mae Beale