Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3x3 Transformations The next set of transformations are a bit more complicated. They are: Gaussian, Laplacian, Unsharp Masking, and Edgy. In these transformations, the value

3x3 Transformations

The next set of transformations are a bit more complicated. They are: Gaussian, Laplacian, Unsharp Masking, and Edgy. In these transformations, the value of a pixel is calculated using the original pixel and its immediate neighbors. That is, a 3x3 grid of pixels is used to calculate the value for a pixel. The red, green, and blue values are handled separately; that is, the new red value is calculated from the old red values; the new green value, from the old green values; and the new blue value, from the old blue values.

The four transforms compute the new pixel values as a weighted average of the old values. The only difference between these transforms is the weights that are used. When you implement these transforms, consider refactoring rather than having completely separate calculations for each of the transforms. There are a couple ways to do this. Please feel free to discuss the options in the forum.

Here are the weights to use for the 3x3 transformations, with some additional notes.

Gaussian

1 2 1
2 4 2
1 2 1

Create a class called Gaussian that implements filter

public interface Filter: { /** * Modify the image according to your algorithm * * @param theImage The image to modify */ void filter(PixelImage theImage); }

public class Pixel { public static final int RED = 0, GREEN = 1, BLUE = 2; // RGB color values for this pixel (0-255) public int[] rgb; /** * Constructor for objects of class Pixel * Initializes the pixel values; * @param red value for red portion of pixel * @param green value for green portion of pixel * @param blue value for blue portion of pixel * @throws IllegalArgumentException if any of the parameters * are not within the bounds of 0 - 255 */ public Pixel(int red, int green, int blue) { if ((red < 0 || red > 255) || (green < 0 || green > 255) || (blue < 0 || blue > 255)) { throw new IllegalArgumentException("bad RGB value for Pixel"); } rgb = new int[3]; rgb[RED] = red; rgb[GREEN] = green; rgb[BLUE] = blue; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

10. What is meant by a feed rate?

Answered: 1 week ago