Box Blur algorithm

This is a challenge from CodeSignal.


image = ((1, 1, 1), 
         (1, 7, 1), 
         (1, 1, 1))

the output should be boxBlur(image) = ((1)).

To get the value of the middle pixel in the input 3 × 3 square: (1 + 1 + 1 + 1 + 7 + 1 + 1 + 1 + 1) = 15 / 9 = 1.66666 = 1. The border pixels are cropped from the final result.


image = ((7, 4, 0, 1), 
         (5, 6, 2, 2), 
         (6, 10, 7, 8), 
         (1, 4, 2, 0))

the output should be

boxBlur(image) = ((5, 4), 
                  (4, 4))

There are four 3 × 3 squares in the input image, so there should be four integers in the blurred output. To get the first value: (7 + 4 + 0 + 5 + 6 + 2 + 6 + 10 + 7) = 47 / 9 = 5.2222 = 5. The other three integers are obtained the same way, then the surrounding integers are cropped from the final result.

Here’s my code:

function boxBlur(image) {  
    const SQUARE = 3
    const outerArr = ()

    for (let i = 0; i < image.length; i++) {
        const innerArr = ()
        for (let j = 0; j < image(0).length; j++) {
            if (image(i)(j) !== undefined && image(i)(j+2) !== undefined && image(i+2)) {
                let sum = 0
                for (let k = 0; k < SQUARE; k++) {
                    for (let y = 0; y < SQUARE; y++) {
                        sum += image(i+k)(j+y)    
        if (innerArr.length) outerArr.push(innerArr)
    return outerArr

LibGDX Shader that converts image to single colour with blur

I made a shader which turns all the colours of the texture to black but I also want it to be blurred.

#ifdef GL_ES
    precision mediump float;

varying vec4 v_color;
varying vec2 v_texCoords;

uniform sampler2D u_texture;

void main() {
  vec4 c = v_color * texture2D(u_texture, v_texCoords);
  gl_FragColor = vec4(0,0,0, c.a);

A simple gaussian blur with good performance is what I want. I tried various blur shaders but haven’t managed to get any to work well. This shadertoy shader looks ideal but not sure how to convert it or make it output only one colour

Original texture with desired output.

enter image description here

How to make Blur Effect in backgroundColor React Native 0.61 >

in Image Component it is working with blurRadius


But I want to create blur effect in backgroundColor

Photo Competition 2021-04-26: All Blur

Theme: All Blur

In the spirit of Why would one shoot a fully blurred picture?, let’s see some abstract and semi-abstract works.

This theme was suggested by mattdm.

Voting Rules

  • Vote up as many images as you like
  • Please, up votes only! Do NOT vote down your competitors! If you don’t like an image, don’t vote
  • Voting closes on April 26, 2021 at 12:01 AM UTC (00:01 UTC if you prefer a 24-hour time). The winner will be chosen based on votes at that time.

Submission Rules

  1. One photo submission per answer. Up to three (3) entries allowed.
  2. Post only photos taken by yourself or the person with you.
  3. All entries should include:
    • a title for the photo
    • a location and date, if known
    • camera, lens, and exposure settings, if known
    • any other explanatory notes, comments, etc., that you want to include (completely optional)
  4. The submitted image must conform to this site’s content license, Creative Commons Attribution-ShareAlike 4.0 (CC BY-SA 4.0) with attribution required.
  5. Do not use this as a forum for photo critique. Use chat instead, or ask a new question about your image.

Next Contest

Suggest a theme by writing a new answer at the Photo of the Week Theme Ideas thread. Please make sure to check the PotW theme ideas Archive first, to make sure you aren’t recycling a theme.

The highest-voted theme will be the next theme.

Good luck!

How to disable wallpaper blur effect on Samsung Galaxy Tab A8.0

so, I went to change my homescreen wallpaper on my samsung galaxy tab a8.0(sm-t290) and every wallpaper comes out as blurry.

in the gallery they work all well and fine, but as a wallpaper? nope.

lock screen looks good.

but the homescreen? well, the astronomy wallpapers I like..look like something my cat yarked up.

how do I fix this?

computer vision – How to apply average blur without using any cv2 function

I tried to get an average blur of an image using cv2 function and the other using self-built function. But the output I am getting in both the cases is quite different. As in the latter one I am getting a black layer above the required image. Can someone help me?

import numpy as np
import math
import cv2 as cv2
img = cv2.imread(“cube.jpg”,1)

 n,m,l= img.shape
 edge = np.full((n, m,l), 255)
 for i in range(1, n-1):
    for j in range(1, m-1):
        for k in range(l):
            edge(i)(j)(k) = 1/9*(img(i-1)(j-1)(k)+img(i-1)(j)(k)+img(i-1)(j+1)(k)+img(i)(j-1)(k)+img(i)(j)(k)+img(i)(j+1)(k)+img(i+1)(j-1)(k)+img(i+1)(j)(k)+img(i+1)(j+1)(k))

#img = img.astype(np.uint32)
Hori = np.concatenate((blur, edge), axis=1)
cv2.imshow('image', Hori.astype(np.uint8))


output of the program

blur – What is causing this halo effect?

I shot a row of action images of a canada goose this morning and noticed that there is a halo around the wings on almost every image. It doesnt look like motion blur to me. What is causing this and how can I remove it in post? Can I prevent this the next time?

Setup: Nikon D4 + 200-400mm F/4 @ 1/640s F/4 ISO 800

enter image description here

Provide background blur on front camera for third party apps

For reasons too tedious to list, I’m currently having to use my Android Phone with Microsoft Teams for video calls and meetings.

Teams on Android doesn’t provide background blur or replacement. Anyone know of an App that can do this? Something that cuts in between Teams and the Selfie/Front Facing Camera to blur or replace the background?

This is on a stock OnePlus Nord, unrooted.

beginner – How can I blur a specific part of an HTML table using CSS

Okay, so I’ve been getting into code lately, and I want to blur an image in an HTML single-cell table, and then have the box of text not blurred. Currently, the text box is embedded inside the first single-cell table, but it is a second single-cell table. How can I keep the same box of text while at the same time unblurring it and blurring the photo behind it. (The rainforest is a placeholder)

font {
  text-shadow: 2px 2px #FF0000;

table.img {
  -webkit-filter: blur(1); /* Safari 6.0 - 9.0 */
filter: blur(1px);}


<lj-raw><table width="500" height="225" background="" align="center" cellpadding="20" cellspacing="0" class="img">
        <td valign="bottom">

            <table align="right" bgcolor="" background="" cellpadding="10" cellspacing="0"><tr><td>
<div align="right">
<font size="5px" color="#FFFFFF 

" face="impact" text-shadow="10px 4px 10px">
<font size="2" color="#fff" face="impact">
                    <br>- Subtitle

c++ – How to combine bilateral blur passes?

I’m changing to bilateral blur for my SSAO implementation, just wondering how people usually combine the two passes – do you just add them together, or average, or something else?

I happen to be using Vulkan but don’t think that should affect the answer too much.