# PSET4 (More Comfortable) Filter Edges

I am trying to code Pset4 (more comfortable) edges, the program is running, but my outcome is completely white. Any Suggestions? Here's My Code....

``````void edges(int height, int width, RGBTRIPLE image[height][width])
``````

{
RGBTRIPLE out[height][width];

``````// Making A Copy Of Image

for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
out[i][j] = image[i][j];
}
}

int Gx[3][3] =
{
{-1,0,1},
{-2,0,2},
{-1,2,1}
};
int Gy[3][3] =
{
{-1,-2,-1},
{0,0,0},
{1,2,1}
};

// Going Through The Image
for (int i = 0; i < height; i++)
{
// Declaring x,y components

long rx = 0, ry = 0;
long gx = 0, gy = 0;
long bx = 0, by = 0;

for (int j = 0; j < width; j++)
{
// Going Through Gx and Gy Matrix

for (int m = 0; m < 3; m++)
{
for (int n = 0; n < 3; n++)
{
if (i-1+m < 0 || i-1+m > height - 1 || j-1+n < 0 || j-1+n > width - 1 )
{
continue;
}
rx += image[i-1+m][j-1+n].rgbtRed * Gx[m][n];
ry += image[i-1+m][j-1+n].rgbtRed * Gy[m][n];
bx += image[i-1+m][j-1+n].rgbtBlue * Gx[m][n];
by += image[i-1+m][j-1+n].rgbtBlue * Gy[m][n];
gx += image[i-1+m][j-1+n].rgbtGreen * Gx[m][n];
gy += image[i-1+m][j-1+n].rgbtGreen * Gy[m][n];
}
}

int red = round( fmin(255,sqrt((rx*rx) + (ry*ry))) );
int blue = round( fmin(255,sqrt((bx*bx) + (by*by))) );
int green = round( fmin(255,sqrt((gx*gx) + (gy*gy))) );

// Setting Value In Image

image[i][j].rgbtRed = red;
image[i][j].rgbtGreen = green;
image[i][j].rgbtBlue = blue;

}
}

return;
``````

}