This repository is the source code for my blog post Template Matching and Color Segmentation in Image Processing: Where's Wally?. This script demonstrates using correlation matching and color segmentation to find desired object (Wally) in an image. This project aims to locate an object from an image.
-
Correlation Matching:
This method loops through the image in an attempt to find the object template. For each location, the difference between the template and the neighborhood is calculated and recorded. The location with minimum difference is returned. -
Color Segmentation: This method firstly converts the image to HSV color space and use the Hue and Saturation to segment the red and write stripes. Then a vertical linear structuring element is used to dilate the stripes and find their overlapped area so the result will be only connected red and white area.
Wally (Wally.png) is lost at a Cosplay convention (Where.jpg). Find him.
-
Correlation matching would work well here for starters;
-
Challenge : Using this method on the full-size image (WhereLarge.jpg) is painfully slow. See if you can find Wally without using the template image but instead by recognising Wally and his stylish red and white T-shirt. (try colour segmentation then morphology here);
Correlation Matching | Color Segmentation |
---|---|
![]() |
![]() |
Please see the file named LICENSE.md.
- Chen Yumin
- Chen Yumin: http://chenyumin.com/
- CharmySoft: http://CharmySoft.com/
- Email: [email protected]