Week 4
Well, its week four and here we are, this is where the difficulty ensues. Well, at least for me. This week we started to learn about blurring.
Convolution Kernel
Filtering
Kernel filtering is a way of processing images through a
“filter”. Through it you take a sample of the pixel and the surrounding pixels
from its texture, then you use the sum of these pixels based on their weight.
This new pixel is placed on to a new texture.
More information: http://www.aforgenet.com/framework/features/convolution_filters.html
Blurring
Box Filter – A filter\ where every pixel is weighted the
same.
Left- regular image,
Right – Box Blurred
Gaussian Blurring - Where the middle has a higher weight and
the surrounding ones have a lower weighting; the bigger the sample window, the
stronger the blur.
Edge Detection
Design a convolution kernel that favours things with a high change.
Output values where left right values are different. For example the following
is a sobel filter.
-1
|
0
|
1
|
-2
|
0
|
2
|
-1
|
0
|
2
|
-1
|
-2
|
-1
|
0
|
0
|
0
|
1
|
2
|
2
|
The top graph detects for edges on the x axis while the bottom graph detects for edges on the y axis. This gathers data for when the
color of an object drastically changes letting us find when there is an edge.
Then at this edge we can add in extra light. Normally you would do this in the
lighting and shading but you do not have access to your neighbors in a fragment
or vertex shader, therefore you need to do this in a second pass after the
whole scene is saved as an image.
HDR, Bloom and
Frame Processing
HDR and bloom are done though a post processing effect. It
is done after you have your geometry and lighting.
Following the above steps you should end up with three separate
textures which you merge together into the final frame. This data is processed
in layers where you start with the base image and add the data together into a
new image. This is done after rendering. To display your final image you would
save everything in you back buffer, then make it into a texture. Then you make
a quad the size of the screen and attach this texture to it. Through this
process you can do everything through shaders. By sending the vertex information
you can interpolate the UVs of the quad and send them to a pixel shader; this
shader is called for every pixel. This means that this whole process can go
into one function. If we want to make the image smaller than we just need to
draw it at a percentage of its size.





No comments:
Post a Comment