Sliding Gaussian Blur Kernel on a Grayscale Image
受此動畫啟發?
Gaussian Blur Kernel Sliding Animation
Overview
An animation that visualizes a 3×3 Gaussian blur kernel moving across a grayscale image. For each position the weighted sum of the underlying pixel values is shown, highlighting the contribution of each kernel element, and the resulting blurred pixel value is displayed. A dark background with a grid is used, kernel cells are colored cyan, the summed result highlighted in yellow, and a short Python/NumPy code snippet is shown in a side panel.
Phases
| # | Phase Name | Duration | Description |
|---|---|---|---|
| 1 | Setup & Overview | ~3s | The dark background appears, a small 5×5 grayscale image grid is drawn (pixel values shown as light gray squares). The 3×3 Gaussian kernel (cyan squares) is placed at the top‑left corner, and the code panel (yellow background) fades in on the right side. |
| 2 | First Convolution Step | ~4s | The kernel slides to the first central position. Each overlapping pixel lights up, the corresponding kernel weight (displayed as a small number inside the cyan cell) multiplies the pixel value, and arrows illustrate the multiplication. The weighted contributions are summed (shown as a running total in the caption area) and the resulting blurred pixel (yellow square) is placed in the output location. |
| 3 | Sliding Across Image | ~8s | The kernel moves step‑by‑step across the image (left‑to‑right, top‑to‑bottom). For each step the same weighted‑sum visualisation repeats, with the previous output pixel staying on the image to build the blurred result. The code panel stays static. |
| 4 | Final Result & Wrap‑up | ~3s | After the kernel reaches the last position, the full blurred image is highlighted, and a brief highlight of the line blurred = convolve2d(image, kernel, mode='same') in the code panel is shown. The scene fades out. |
Layout
┌─────────────────────────────────────┬─────────────────────┐
│ │ │
│ MAIN (image & │ CODE PANEL │
│ moving kernel) │ (Python/NumPy) │
│ │ │
├─────────────────────────────────────┼─────────────────────┤
│ Caption / running sum (small footer)│ │
└─────────────────────────────────────┴─────────────────────┘
Area Descriptions
| Area | Content | Notes |
|---|---|---|
| Main | Grayscale image grid, cyan‑colored 3×3 Gaussian kernel, yellow highlighted output pixel, arrows and small numeric weights inside kernel cells. | Primary visual focus; occupies ~70 % of width. |
| Code Panel | Short Python/NumPy snippet illustrating the kernel definition and convolution call. Background colored dark‑yellow for contrast. | Fixed width on the right; no animation inside except occasional highlight. |
| Caption | Small text line showing the current weighted‑sum expression, e.g., Σ wᵢ·pᵢ = 123. |
Appears at bottom band; updates each step. |
Notes
- Assumptions: Image size 5×5 for clarity; pixel values are arbitrary grayscale intensities (0–255) displayed as light gray squares. Kernel values are the standard Gaussian . Code snippet limited to ~4 lines.
- Colors: background #111111, grid lines cyan, kernel cells cyan fill, output pixel yellow fill, code panel background #222200.
- No additional text objects beyond the caption and code panel; all mathematical relationships are shown visually.
- All timing is approximate; total animation length ~18 seconds, suitable for clear pedagogical pacing.
- The entire animation fits within a single Manim
Sceneclass.
建立者
描述
The animation shows a 3 by 3 Gaussian blur kernel moving across a small 5 by 5 grayscale image. Each step highlights the overlapping pixels, displays the kernel weights, multiplies them, and sums the contributions to produce a blurred pixel shown in yellow. A side panel presents the Python NumPy code defining the kernel and performing the convolution. The caption updates with the current weighted sum, and the final blurred image is revealed at the end.
建立於
Nov 8, 2026, 06:19 AM
時長
0:35