In this article, I will explain how to deal with an image and apply filters to it. In order to do so, we must understand how the image data is stored so that it becomes easy to apply filters using matrix operations.
In the following example I will demonstrate how to:
-
Load an image from file
-
Store image in a byte matrix
-
Apply Grayscale filter
Step 1
Create a new Windows 8 Store app project, as in:

Step 2
Add the following code the "MainPage.xaml":
|
Step 3
Go to the backend and add the following namespaces to the already existing ones:
|
Step 4
Add event handlers to the image picker button:
|
Step 5
This is where we implement the grayscale filter. This filter works simply by averaging the value of the red, green and blue at each pixel of the image, then sets this value to all 3 channels. This is demonstrated in the following loop:
|
The following is a sample result:

Fahad ArshadPosted Oct 26, 2014, 3:22 PM
Thank you.. although I had to correct the errors. but your code gave me want I wanted..
farrukh ahmedPosted Jun 14, 2013, 4:16 AM
Sir, your uploaded project is not running due to error of "$safeprojectname$", can you kindly mail the working project at "[email protected]", i will be very grateful to you, thanks...