147
edits
Changes
→Introduction : GPU Benchmarking/Gaussian Blur Filter : Colin Paul
An even better way would be to integrate the Gaussian function instead of just taking point samples. Refer to the diagram on the right.<br/>
For the current configuration, we have 13.36% of the curve’s area outside the discrete kernel. Note that the weights are renormalized such that the sum of all weights is one. Or in other words:<br/>
the probability mass outside the discrete kernel is redistributed evenly to all pixels within the kernel. The weights are calculated by numerical integration of the continuous gaussian distribution<br/>
speed versus quality.
===Running program===
===Code===
{| class="wikitable mw-collapsible mw-collapsed"
! Windows - Gassusan Blur Filter Source Code Main (Visual Studio)
|-
|
<syntaxhighlight lang="cpp">
//Example from https://goo.gl/aAUr6m
#include <iostream>
#include <stdio.h>
{| class="wikitable mw-collapsible mw-collapsed"
! Linux - Gassusan Blur Filter Source Code Main (Command Line)
|-
|
char *destFileName = argv[2];
#endif /* RUNG_ROF RUN_GROF */
if (showUsage)
{| class="wikitable mw-collapsible mw-collapsed"
! Linux - Header Source Code (Linux cannot use the Windows API, had to replicate the required structs. Ref: MSDN)
|-
|
typedef struct tagBITMAPFILEHEADER
{
WORD bfType; // 2 /* Magic identifier File type */
DWORD bfSize; // 4 /* File size in bytes */
WORD bfReserved1; // 2
|}
====Windows====
To compile and run the program:
# Set-up an empty Visual C++ - Visual Studio project.
# Save [http://matrix.senecac.on.ca/~cpaul12/cinque_terre.bmp this] image and place it in your projects directory.
# Copy the Windows version of the main source code below above and paste it into a [your chosen file name].cpp file.
# Go into you Debug properties of your project.
# Add four (4) values into the Debugging -> Command Arguments:
# Navigate to the directory you want to run the program in.
# Save [http://matrix.senecac.on.ca/~cpaul12/cinque_terre.bmp this] image and place it directory you will be running the program from.
# Copy the Linux version of the main source code below above and paste it into a [your chosen file name].cpp file.# Copy the Linux version of the header source code below above and paste it into a file name named windows.h.
Compile the binaries using the following command:
g++ -O2 -std=c++0x -Wall -pedantic gaussian[your chosen file name].cpp -o blurgblur
Run the compiled prigram
./blur gblur cinque_terre.bmp cinque_terre_BLURRED.bmp 3.0 3.0
The command line arguments are structured as follows:
[input image filename].bmp [output image filename].bmp [x - sigma value] [y - sigmea value]