20:
550:
255:
X P X X X X // Calculate average. Sum = image + // Top left image + // Top center image + // Top right image + // Mid left image + // Current pixel image + // Mid right image + // Low left image + // Low center image; // Low right newImage = Sum / 9; } Return newImage; }
254:
Box blur (image) { set newImage to image; For x /*row*/, y/*column*/ on newImage do: { // Kernel would not fit! If x < 1 or y < 1 or x + 1 == width or y + 1 == height then: Continue; // Set P to the average of 9 pixels: X X X
31:(also known as a box linear filter) is a spatial domain linear filter in which each pixel in the resulting image has a value equal to the average value of its neighboring pixels in the input image. It is a form of low-pass ("blurring") filter. A 3 by 3 box blur ("radius 1") can be written as matrix
125:
236:
165:
Gwosdek, et al. has extended Box blur to take a fractional radius: the edges of the 1-D filter are expanded with a fraction. It makes slightly better gaussian approximation possible due to the elimination of integer-rounding
328:
Accumulation. Instead of discarding the sum for each pixel, the algorithm re-uses the previous sum, and updates it by subtracting away the old pixel and adding the new pixel in the blurring range. A
130:
Due to its property of using equal weights, it can be implemented using a much simpler accumulation algorithm, which is significantly faster than using a sliding-window algorithm.
259:
The example does not handle the edges of the image, which would not fit inside the kernel, so that these areas remain unblurred. In practice, the issue is better handled by:
37:
152:
with a period equal to the size of the box will be blurred away entirely, and wavelengths shorter than the size of the box may be phase-reversed, as seen when two
175:
395:
587:
352:
486:
528:"Hmm, aside from my note about how the family of kernels Costella discovered are precisely the uniform cardinal B-splines..."
241:
Stacked
Integral Image by Bhatia et al. takes the weighted average of a few box blurs to fit the gaussian response curve.
156:
circles touch to form a bright spot where there would be a dark spot between two bright spots in the original image.
19:
611:
606:
580:
322:
305:
pixels will be needed, one horizontal and one vertical, for each pixel. This lowers the complexity from
138:
120:{\displaystyle {\frac {1}{9}}{\begin{bmatrix}1&1&1\\1&1&1\\1&1&1\end{bmatrix}}.}
573:
468:
172:
has a "stack blur" that tries to better emulate gaussian's look in one pass by stacking weights:
408:
455:
329:
443:
294:
169:
145:
370:
557:
549:
600:
375:
365:
231:{\displaystyle {\frac {1}{9}}{\begin{bmatrix}1&2&3&2&1\end{bmatrix}}}
134:
281:
A number of optimizations can be applied when implementing the box blur of a radius
505:
527:
238:
The triangular impulse response it forms decomposes to two rounds of box blur.
149:
448:
431:
355:
construction allows for doing the equivalent operation in a single pass.
351:
When being used in multiple passes to approximate a
Gaussian blur, the
141:, repeated application of a box blur will approximate a Gaussian blur.
153:
18:
266:
Extending the boundary by filling in values, ranked by quality:
263:
Introducing an alpha channel to represent the absence of colors;
321:. In digital signal processing terminology, each pass is a
148:, a box blur has zeros and negative components. That is, a
561:
332:
can be used similarly. This lowers the complexity from
272:
Fill in a constant color extending from the last pixel
194:
56:
178:
40:
250:
The following pseudocode implements a 3x3 box blur.
230:
119:
133:Box blurs are frequently used to approximate a
23:An example of an image blurred using a box blur
581:
8:
432:"ASurvey of Gaussian Convolution Algorithms"
588:
574:
297:, so that only two 1D passes of averaging
447:
189:
179:
177:
51:
41:
39:
506:"Fastest Gaussian Blur (in linear time)"
409:15.17 Filter primitive 'feGaussianBlur'
387:
556:This photography-related article is a
425:
423:
421:
419:
417:
269:Fill in a mirrored image at the border
430:Getreuer, Pascal (17 December 2013).
7:
546:
544:
469:"Stackblur and Quadratic Stackblur"
14:
487:"How to Blur an Image on Android"
548:
353:cascaded integrator–comb filter
1:
560:. You can help Knowledge by
628:
543:
407:W3C SVG1.1 specification,
436:Image Processing on Line
252:
396:Fast Image Convolutions
394:Wojciech Jarosz. 2001.
232:
121:
24:
233:
139:central limit theorem
122:
22:
449:10.5201/ipol.2013.87
275:Pad in a fixed color
176:
38:
493:. 10 February 2020.
475:. 12 November 2018.
293:The box blur is a
228:
222:
117:
108:
25:
16:Graphic-art effect
612:Photography stubs
569:
568:
526:Sitaker, Kragen.
330:summed-area table
187:
49:
619:
607:Image processing
590:
583:
576:
552:
545:
535:
534:
523:
517:
516:
514:
512:
501:
495:
494:
483:
477:
476:
473:observablehq.com
465:
459:
453:
451:
427:
412:
405:
399:
392:
347:
339:
320:
312:
304:
295:separable filter
237:
235:
234:
229:
227:
226:
188:
180:
170:Mario Klingemann
146:frequency domain
126:
124:
123:
118:
113:
112:
50:
42:
627:
626:
622:
621:
620:
618:
617:
616:
597:
596:
595:
594:
541:
539:
538:
525:
524:
520:
510:
508:
504:Kutsvir, Ivan.
503:
502:
498:
485:
484:
480:
467:
466:
462:
429:
428:
415:
406:
402:
393:
389:
384:
371:Gaussian filter
362:
341:
333:
314:
306:
298:
257:
256:
248:
221:
220:
215:
210:
205:
200:
190:
174:
173:
162:
107:
106:
101:
96:
90:
89:
84:
79:
73:
72:
67:
62:
52:
36:
35:
17:
12:
11:
5:
625:
623:
615:
614:
609:
599:
598:
593:
592:
585:
578:
570:
567:
566:
553:
537:
536:
518:
496:
478:
460:
413:
400:
386:
385:
383:
380:
379:
378:
373:
368:
361:
358:
357:
356:
349:
326:
323:moving-average
279:
278:
277:
276:
273:
270:
264:
253:
247:
246:Implementation
244:
243:
242:
239:
225:
219:
216:
214:
211:
209:
206:
204:
201:
199:
196:
195:
193:
186:
183:
167:
161:
158:
128:
127:
116:
111:
105:
102:
100:
97:
95:
92:
91:
88:
85:
83:
80:
78:
75:
74:
71:
68:
66:
63:
61:
58:
57:
55:
48:
45:
15:
13:
10:
9:
6:
4:
3:
2:
624:
613:
610:
608:
605:
604:
602:
591:
586:
584:
579:
577:
572:
571:
565:
563:
559:
554:
551:
547:
542:
532:
529:
522:
519:
507:
500:
497:
492:
488:
482:
479:
474:
470:
464:
461:
457:
450:
445:
441:
437:
433:
426:
424:
422:
420:
418:
414:
410:
404:
401:
397:
391:
388:
381:
377:
376:Median filter
374:
372:
369:
367:
366:Gaussian blur
364:
363:
359:
354:
350:
345:
337:
331:
327:
324:
318:
310:
302:
296:
292:
291:
290:
288:
284:
274:
271:
268:
267:
265:
262:
261:
260:
251:
245:
240:
223:
217:
212:
207:
202:
197:
191:
184:
181:
171:
168:
164:
163:
159:
157:
155:
151:
147:
142:
140:
136:
135:Gaussian blur
131:
114:
109:
103:
98:
93:
86:
81:
76:
69:
64:
59:
53:
46:
43:
34:
33:
32:
30:
21:
562:expanding it
555:
540:
530:
521:
509:. Retrieved
499:
490:
481:
472:
463:
439:
435:
403:
390:
343:
335:
316:
308:
300:
286:
282:
280:
258:
249:
143:
132:
129:
28:
26:
531:Hacker News
442:: 286–310.
601:Categories
382:References
160:Extensions
150:sine wave
137:. By the
456:code doc
360:See also
289:pixels:
29:box blur
511:4 April
325:filter.
144:In the
491:Medium
166:error.
154:bokeh
558:stub
513:2020
285:and
444:doi
340:to
313:to
303:+ 1
603::
489:.
471:.
438:.
434:.
416:^
342:O(
336:Nr
334:O(
317:Nr
315:O(
309:Nr
307:O(
299:2
27:A
589:e
582:t
575:v
564:.
533:.
515:.
458:)
454:(
452:.
446::
440:3
411:.
398:.
348:.
346:)
344:N
338:)
319:)
311:)
301:r
287:N
283:r
224:]
218:1
213:2
208:3
203:2
198:1
192:[
185:9
182:1
115:.
110:]
104:1
99:1
94:1
87:1
82:1
77:1
70:1
65:1
60:1
54:[
47:9
44:1
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.