VB.net can Emboss an image quickly with this short bit of code. Make sure the following imports are included at the top of your module.
To apply the filter, the program considers each pixel in the image (except those
on the very edges of the image). It looks at the 3x3 square of pixels surrounding
the target pixel and multiplies their red, green, and blue component values by the
corresponding filter value. It adds the results and divides by the filter's weight.
For an embossing filter, the program then adds 127 to make pixels with a neutral
value become gray.
Note that the embossing filter only has two non-zero values and that its weight
is 1. You can improve performance slightly by performing the multiplications directly
rather than by looping through the filter array. That makes the code a bit less
general, however, so it would be harder to modify to apply other filters. For example,
try changing the values in the filter array and then setting the weight to the sum
of the values in the array to see what happens.
|
|
|
Start |
Embossed |
 |
|
Thank you for viewing this source code. If you want to download the project files and a copy of this source code you must either fill out this form with a valid email address as some useful commets about this site or you may become a member free of charge. In either case a link will be emailed where you can down load the project filess.
|
|
|