Coconote
AI notes
AI voice & video notes
Try for free
🖼️
Understanding Feature Extraction in Images
Oct 12, 2024
Feature Extraction from Images
Introduction
Feature extraction is crucial in image data processing.
It involves understanding how a computer interprets image data, often stored as a matrix.
Simple Approach to Feature Extraction
Black and White Images
Images are interpreted as matrices.
Example: A 22x16 pixel image is stored as a 352 pixel matrix.
Pixel values range from 0 (black) to 255 (white).
Features can be represented by flattening the matrix into a 1x352 vector.
Color Images
Stored as three matrices (channels) for blue, green, and red.
Similar approach by calculating mean pixel values across channels.
Limitations
Simple approach is prone to noise (e.g., background, color differences, expressions).
Computationally expensive and retains unnecessary information.
Advanced Feature Extraction: HOG (Histogram of Oriented Gradients)
Concept
HOG computes pixel-wise gradients and orientations.
Represents images in a noise-reduced form.
Steps to Build HOG Representation
1. Image Pre-processing
Standardize image size, e.g., resizing to 32x64 pixels.
Divide resized image into smaller cells, e.g., 4x4 pixels.
2. Calculating Gradients and Orientations
Compute gradients in x (gx) and y (gy) directions.
Calculate gradient magnitude and orientation.
Use Pythagoras theorem for magnitude and inverse tangent for orientation.
3. Plotting Histograms
Orientations are binned (e.g., 20-degree bins, 9 bins total).
Distribute gradient magnitudes into bins based on orientation.
Results in a 1x9 feature matrix per cell.
4. Normalization
Form blocks of cells for normalization to reduce sensitivity to lighting variations.
Calculate block features and normalize using root sum of squares.
Shift blocks across the image to compute normalized vectors for all blocks.
Feature Matrix
HOG results in a 1x3780 dimensional image descriptor.
Dimensionality Reduction
The high dimensionality of features can lead to computational expense and overfitting.
PCA (Principal Component Analysis) is used to reduce dimensions.
Conclusion
HOG is an effective feature descriptor for minimizing noise and focusing on crucial information in images.
📄
Full transcript