I have successfully finished the blur effect on PSET4.
Here is a small smattering of the code
if(i - 1 >= 0 && j - 1 >= 0)
{
red += OgImage[i-1][j-1].rgbtRed;
blue += OgImage[i-1][j-1].rgbtBlue;
green += OgImage[i-1][j-1].rgbtGreen;
Divide++;
}
if(i - 1 >= 0 && j >= 0)
{
red += OgImage[i-1][j].rgbtRed;
blue += OgImage[i-1][j].rgbtBlue;
green += OgImage[i-1][j].rgbtGreen;
Divide++;
}
if(i - 1 >= 0 && j + 1 < width)
{
red += OgImage[i-1][j+1].rgbtRed;
blue += OgImage[i-1][j+1].rgbtBlue;
green += OgImage[i-1][j+1].rgbtGreen;
Divide++;
}
if(i >= 0 && j - 1 >= 0)
{
red += OgImage[i][j-1].rgbtRed;
blue += OgImage[i][j-1].rgbtBlue;
green += OgImage[i][j-1].rgbtGreen;
Divide++;
}
etc...
It feels like there is probably some better way of doing this without writing out all this code though? My code passed all the verifications and works as intended. But is there some better way of creating edge of the image detection? He talked a lot about recursion in some of the previous lectures, does this situation lend itself to recursion or some other technique?