Testing Zernike moments a powerfull shape descriptor, based on Zernike polynomials
In mathematics, the Zernike polynomials are a sequence of polynomials that are orthogonal on the unit disk.
Image processing and computer vision techniques such as:
- Edge detection
- Thresholding
- Perspective warping
We can abstractly represent the image using only a list of numbers (image feature vector).
Python Libraries You Will Need:
- Requests
- BeautifulSoup (bs4 web scraping)
- NumPy
- SciPy
- Scikit-Image
- OpenCV (with bindings)
The steps:
- Download images (build a dataset)
- Extract features of the images in terms of their outline (the shape)
- Process (extract features) a new image
- Compare feature of the new image to the features of the dataset (using euclidean distance)
Image moments:
- Calculate the centroid (the center of the object, in terms of x, y coordinates);
- Calculate moments based on the contour of an image. The scaling and translation of the object in the image:
- Depending on where the object is translated in the image, moments will be different;
- Depending on how large or small (the object is scaled) in the image, moments will be different. To avoid descriptors with different values based on the translation and scaling:
- Perform segmentation the foreground from the background;
- Form a tight bounding box around the object and crop it out;
- Translation invariance!
- Resize the object to a constant NxM pixels;
- Scale invariance!
- The Zernike Moment is rotation invariant.
The steps of Execution:
- python web_scraping_images_redblue.py or
- python web_scraping_images_redblue.py -generation 2 or
- python web_scraping_images_redblue.py -g 3 3.1. Download images and place in a folder: sprites\000Name.png
- python indexing.py 4.1. Creates an index file of moments of all images: index.pkl
- python find_screen.py --query screens\gameboy_marowak.jpg 5.1. Creates an image of the object that's found: object.png
- python whos.py --index index.pkl --object object.png 6.1. Compare the object and print its name: The object is: 'Name'
Referenced: https://www.pyimagesearch.com/ by Adrian Rosebrock