I've hit a bit of a brick wall writing a blur function for filter (more). This is my second go at refactoring the code, and although it produces a blurred image without any issues (no weird edges, missing areas etc), it fails check50 Deleted code as it was very similar to the solution. Any ideas, as I'm pretty stuck?
1 Answer
Yes, it produces a blurred picture, just not correctly blurred. You should work with something simple, like a 3x3 bitmap and look at the actual input and output values to see what it does. Specifically, think carefully about when and how the avgRed, avgGreen and avgBlue are updating vs. when they're used.
This is a good example why it's critical to look at raw data when writing code and not just look at images. What may appear to be working correctly could actually be very wrong.