diff --git a/.vscode/settings.json b/.vscode/settings.json index 70e34ec..5d4f378 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,6 @@ { - "C_Cpp.errorSquiggles": "disabled" + "C_Cpp.errorSquiggles": "disabled", + "files.associations": { + "helpers.h": "c" + } } \ No newline at end of file diff --git a/filter.exe b/filter.exe index fce9bae..c7761fb 100644 Binary files a/filter.exe and b/filter.exe differ diff --git a/helpers.c b/helpers.c index ad4a5ae..c585f8a 100644 --- a/helpers.c +++ b/helpers.c @@ -1,5 +1,7 @@ #include "helpers.h" - +#include +#include +#include "bmp.h" int min(int a,int b){ if(a= 0 && ni < height && nj >= 0 && nj < width){ + sumRed += image[ni][nj].rgbtRed; + sumGreen += image[ni][nj].rgbtGreen; + sumBlue += image[ni][nj].rgbtBlue; + count++; + } + } + } + temp[i][j].rgbtRed = (uint8_t)(sumRed / count); + temp[i][j].rgbtGreen = (uint8_t)(sumGreen / count); + temp[i][j].rgbtBlue = (uint8_t)(sumBlue / count); + } + } + // Copy blurred array back to orig + for (int i = 0; i < height; i++) + for (int j = 0; j < width; j++) + image[i][j] = temp[i][j]; + } + for (int i = 0; i < height; i++) + free(temp[i]); + free(temp); +} -// Blur image - -} \ No newline at end of file diff --git a/output.bmp b/out.bmp similarity index 68% rename from output.bmp rename to out.bmp index 8abb92d..6cc4070 100644 Binary files a/output.bmp and b/out.bmp differ