๐️ How Computers See Images – Convolution Explained Like a Story
Imagine you're holding a magnifying glass over a photograph… slowly scanning it piece by piece.
That’s exactly how a computer “sees” an image using convolution.
๐ Table of Contents
- What Are Pixels?
- What is Convolution?
- Math Behind Convolution
- Step-by-Step Process
- Real Example
- Code Example
- CLI Output
- Role in Deep Learning
- Key Takeaways
- Related Articles
๐งฉ What Are Pixels?
An image is just a grid of numbers.
Example:
| 12 | 45 | 78 |
| 34 | 90 | 120 |
| 65 | 23 | 11 |
๐ What is Convolution?
Convolution is like sliding a small window (filter) over an image.
This window looks at small parts and extracts useful information.
๐ Math Behind Convolution (Easy)
Convolution Formula
\[ Output(i,j) = \sum_{m}\sum_{n} Image(i+m, j+n) \times Kernel(m,n) \]
Simple Meaning:
- Multiply numbers from image and filter
- Add them together
- Get one output value
⚙️ Step-by-Step Process
- Place filter on image
- Multiply overlapping values
- Add results
- Move filter right
- Repeat
๐ Example
Image
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
Kernel
| 1 | 0 |
| 0 | -1 |
Calculation
\[ (1×1) + (2×0) + (4×0) + (5×(-1)) = -4 \]
๐ป Code Example
import numpy as np
image = np.array([[1,2,3],
[4,5,6],
[7,8,9]])
kernel = np.array([[1,0],
[0,-1]])
output = image[0:2,0:2] * kernel
print(output.sum())
๐ฅ️ CLI Output
Click to Expand
-4
๐ง Role in Deep Learning
Convolution is used in Convolutional Neural Networks (CNNs).
- First layers → detect edges
- Middle layers → detect shapes
- Deep layers → detect objects
๐ก Key Takeaways
- Convolution scans images in small parts
- Uses simple math (multiply + add)
- Detects patterns like edges and shapes
- Foundation of modern computer vision
๐ฏ Final Thought
Convolution turns images into patterns… and patterns into understanding.
That’s how machines learn to see.
No comments:
Post a Comment