Answered step by step
Verified Expert Solution
Question
1 Approved Answer
need help with c Any kind of blur is essentially making every pixel more similar to those around it. In a horizontal blur, we can
need help with c
Any kind of blur is essentially making every pixel more similar to those around it. In a horizontal blur, we can average each pixel with those in a specific direction, which gives the illusion of motion For this program, we will calculate each new pixels value as half of its original value. The other half is averaged from a fixed number of pixels to the right. This fixed number can be called the BLUR AMOUNT. The larger the value, the more blurring that will occur This is done independently for the red, green, and blue components of each pixel. This is expressed in the following algorithm: For each row of the image o For each pixel in the row: Set r to be half the pixels red component. - Set g to be half the pixels green component. - Set b to be half the pixels blue component. - For i from 1 up to BLUR_AMOUNT 0.5 where R is the red component of the pixel i to the right of the current pixel where G is the green component of the pixel i to the right of the current pixel where B is the blue component of the pixel i to the right of the current pixel. Increment r by R . BLUR AMOUNT 0.5 Increment g by G BLUR AMOUNT, . Increment b by B BLUR AMOUNT 0.5 Save r,g, b as the new color values for this pixel. . You must also ensure you don't access pixels off the bounds of the image. For example, the third pixel from the right should only average itself (half weight), and the next two (at a quarter weight each) Any kind of blur is essentially making every pixel more similar to those around it. In a horizontal blur, we can average each pixel with those in a specific direction, which gives the illusion of motion For this program, we will calculate each new pixels value as half of its original value. The other half is averaged from a fixed number of pixels to the right. This fixed number can be called the BLUR AMOUNT. The larger the value, the more blurring that will occur This is done independently for the red, green, and blue components of each pixel. This is expressed in the following algorithm: For each row of the image o For each pixel in the row: Set r to be half the pixels red component. - Set g to be half the pixels green component. - Set b to be half the pixels blue component. - For i from 1 up to BLUR_AMOUNT 0.5 where R is the red component of the pixel i to the right of the current pixel where G is the green component of the pixel i to the right of the current pixel where B is the blue component of the pixel i to the right of the current pixel. Increment r by R . BLUR AMOUNT 0.5 Increment g by G BLUR AMOUNT, . Increment b by B BLUR AMOUNT 0.5 Save r,g, b as the new color values for this pixel. . You must also ensure you don't access pixels off the bounds of the image. For example, the third pixel from the right should only average itself (half weight), and the next two (at a quarter weight each)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started