Ask Your Question

Is there a function to average (mean) filter for a pixel?

asked 2020-05-28 04:39:11 -0500

ziknehupsu gravatar image

updated 2020-05-28 08:07:29 -0500

Hello everyone,

I have a 640x480 pixels photo.

I'm considering applying an average(mean) filter for the example (105,145) pixel.

Opencv have cv2.blur() function.

But this function applies average filter to all pixels.

I want to apply it to any pixel.

Does anyone have any suggestions?


edit retag flag offensive close merge delete


please explain, what the mean of a single pixel should be (it does not make any sense to me)

did you mean: filtering a small region, a roi ?

berak gravatar imageberak ( 2020-05-28 04:56:26 -0500 )edit

Sorry for not telling you. E.g. I have a 100x100 pixels photo. The pixel in the 50. row and 50. column of the photo has no value. But other pixels have value. I want to find this value using the average of the pixels that are close to its surroundings.

In other words, I want to assign RGB value to the 50. row and 50. column based on the pixels around it.

ziknehupsu gravatar imageziknehupsu ( 2020-05-28 05:02:10 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-05-28 05:47:59 -0500

kbarni gravatar image

updated 2020-05-28 09:45:20 -0500

That is called inpainting.

[edit] By the way, the inpainting is a more intelligent method than getting a mean of the surrounding pixels. It tries to recreate the texture and other structural elements of the missing zone.

edit flag offensive delete link more


Sounds very similar to whats happening the convolution layer(s).

holger gravatar imageholger ( 2020-05-28 13:56:41 -0500 )edit

Question Tools

1 follower


Asked: 2020-05-28 04:39:11 -0500

Seen: 137 times

Last updated: May 28 '20