Gaussian Blur Filter
Convolutional image smoothing using Gaussian kernel. Reduces noise and detail. Used for preprocessing in CV pipelines.
Visualization
Interactive visualization for Gaussian Blur Filter
Kernel:
Gaussian Filter:
- • Smoothing/blurring
Interactive visualization with step-by-step execution
Implementation
1function gaussianBlur(image: number[][], kernelSize: number, sigma: number): number[][] {
2 const kernel = generateGaussianKernel(kernelSize, sigma);
3 return convolve2D(image, kernel);
4}
5
6function generateGaussianKernel(size: number, sigma: number): number[][] {
7 const kernel: number[][] = [];
8 const mean = Math.floor(size / 2);
9 let sum = 0;
10
11 for (let x = 0; x < size; x++) {
12 kernel[x] = [];
13 for (let y = 0; y < size; y++) {
14 const exp = -((x - mean) ** 2 + (y - mean) ** 2) / (2 * sigma ** 2);
15 kernel[x][y] = Math.exp(exp);
16 sum += kernel[x][y];
17 }
18 }
19
20 // Normalize
21 for (let x = 0; x < size; x++) {
22 for (let y = 0; y < size; y++) {
23 kernel[x][y] /= sum;
24 }
25 }
26 return kernel;
27}Deep Dive
Theoretical Foundation
Convolves image with Gaussian kernel G(x,y) = (1/2πσ²)×e^(-(x²+y²)/2σ²). Larger σ = more blur. Separable filter: 2D → two 1D passes for O(w×h×k) optimization.
Complexity
Time
O(w×h×k²)
O(w×h×k²)
O(w×h×k²)
Space
O(w×h)
Applications
Industry Use
Image preprocessing for edge detection
Noise reduction in medical imaging
Photography and image editing software
Computer vision pipeline preprocessing
Scale-space analysis and feature detection
Video processing and stabilization
Use Cases
Related Algorithms
A* Search Algorithm
Informed search algorithm combining best-first search with Dijkstra's algorithm using heuristics. Widely used in pathfinding and graph traversal, A* is optimal and complete when using admissible heuristic. Used in games, GPS navigation, and robotics. Invented by Peter Hart, Nils Nilsson, and Bertram Raphael in 1968.
Convex Hull (Graham Scan)
Find smallest convex polygon containing all points. Graham Scan invented by Ronald Graham in 1972, runs in O(n log n). Essential in computational geometry, computer graphics, and pattern recognition.
Line Segment Intersection
Determine if two line segments intersect. Fundamental geometric primitive used in graphics, CAD, GIS. Uses orientation and collinearity tests.
Caesar Cipher
The Caesar Cipher is one of the oldest and simplest encryption techniques, named after Julius Caesar who used it to protect military messages around 100 BC. It works by shifting each letter in the plaintext by a fixed number of positions down the alphabet. For example, with a shift of 3, A becomes D, B becomes E, and so on. Despite being used for over 2000 years, it's extremely weak by modern standards with only 25 possible keys, making it trivially breakable by brute force or frequency analysis.