Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4111114
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:01:28+00:00 2026-05-20T22:01:28+00:00

multiplying each pixel by the average blurring mask *(1/9) but the result is totally

  • 0

multiplying each pixel by the average blurring mask *(1/9) but the result is totally different.

PImage toAverageBlur(PImage a)
{
   PImage aBlur = new PImage(a.width, a.height);

   aBlur.loadPixels();

   for(int i = 0; i < a.width; i++)
   {
      for(int j = 0; j < a.height; j++)
      {
        int pixelPosition = i*a.width + j;
        int aPixel = ((a.pixels[pixelPosition] /9));

        aBlur.pixels[pixelPosition] = color(aPixel);
      }
   }
   aBlur.updatePixels();

   return aBlur;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:01:29+00:00Added an answer on May 20, 2026 at 10:01 pm

    Currently, you are not applying an average filter, you are only scaling the image by a factor of 1/9, which would make it darker. Your terminology is good, you are trying to apply a 3×3 moving average (or neighbourhood average), also known as a boxcar filter.

    For each pixel i,j, you need to take the sum of (i-1,j-1), (i-1,j), (i-1,j+1), (i,j-1), (i,j),(i,j+1),(i+1,j-1),(i+1,j),(i+1,j+1), then divide by 9 (for a 3×3 average). For this to work, you need to not consider the pixels on the image edge, which do not have 9 neighbours (so you start at pixel (1,1), for example). The output image will be a pixel smaller on each side. Alternatively, you can mirror values out to add an extra line to your input image which will make the output image the same size as the original.

    There are more efficient ways of doing this, for example using FFT based convolution; these methods are faster because they don’t require looping.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am changing color values of each pixel in an image based on a
I want to calculate each row's total price by multiplying individual row's inputs and
I am doing a program where I'm multiplying matricies, but my big issue is
I'm having problems multiplying two matrices of dimensions 5000x1024. I tried to do it
I am multiplying the values of a few decimal columns together in SQL Server
I am having difficulties multiplying the numpy datatype timedelta64 with floats. For a task
I'm trying to create a grammar for multiplying and dividing numbers in which the
How is different from multiplexing several sockets via a POLLIN? while True: socks =
Sorry, this is a bit of code, but there's not much to cut out
I am multiplying two matrices using two threads (however, the program is written to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.