0

The four transformations you should implement all compute the new pixel values as a weighted average of the old ones. The only difference between them is the actual weights that are used. You should be able to add a single method inside class PixelImage to compute a new image using weighted averages, and call it from the methods for the specific transformations with appropriate weights as parameters. You should not need to repeat the code for calculating weighted averages four times, once in each transformation. The method you add to PixelImage to do the actual calculations can, of course, call additional new methods if it makes sense to break the calculation into smaller pieces.

Here are the weights for the 3x3 transformations you should implement.

Gaussian

1 2 1

2 4 2

1 2 1

After computing the weighted sum, the result must be divided by 16 to scale the numbers back down to the range 0 to 255. The effect is to blur the image.

I have no idea how to do this. Can anyone help? I only learned basics so far up to 2d arrays.

  • @KrzysztofCichocki Not really, since this is homework and the other one is not. OP here needs to do the operations by hand instead of using the ready-made classes. – Kayaman Jun 16 '16 at 07:19
  • I don't understand the variables used in the link you posted above. I'm only in Csc 142 which is introduction to Java. – ninjaxdomo Jun 16 '16 at 07:20
  • @ninjaxdomo So what's the problem? Raster images are basically 2D arrays of pixels, so you should be all set to go. You know how to use arrays and you should know mathematical operations too. – Kayaman Jun 16 '16 at 07:20
  • @Kayaman Yes I know how to use arrays and the mathematical operations, but I don't know where to start. How do I calculate the weighted averages and implement it into a method? – ninjaxdomo Jun 16 '16 at 07:24
  • @ninjaxdomo Can you tell me why so many students seem to be incapable of using Google? This is an honest question. People say "I don't know where to start" whereas they could go to Google type in some keywords (like "weighted average" in this case) and they'd get all the information they need. Is googling no longer a basic skill, so that it should actually be taught in school? It's a lot faster than trying to get an answer on SO, all you need to do is some reading. Wikipedia contains a lot of programming articles as well. Are the teachers telling/recommending SO to students? – Kayaman Jun 16 '16 at 07:30
  • @Kayaman I have been googling this, but they all seem to use ready-made classes and don't really teach me how to do it. – ninjaxdomo Jun 16 '16 at 07:35
  • @ninjaxdomo I can only recommend more googling. If you can't find anything from the biggest source of information on the planet, the problem is not on Google's side. – Kayaman Jun 16 '16 at 07:47

0 Answers0