Java Reference
In-Depth Information
Figure 7-29. Select Blur from the Process menu to blur the image.
IfyouweretoapplytheblurkerneltoanARGBimage,whereallalphacomponent
valuesare255(or1.0)toindicateanopaqueimage,thedestinationimage'salphavalues
wouldbethesameasthesourceimage'salphavalues.Thereasonisthattheblurkernel
divideseachofthesourceandneighboralphavaluesbynineandthenaddstheresults
together, resulting in the source pixel's original alpha value.
Youcancreateanedgekernelthatemphasizesanimage'sedgesbysubtractingneigh-
borpixelcomponentsfromsourcepixelcomponents.Theresultingkernelappearshere:
float[] edgeKernel =
{
0.0f, -1.0f, 0.0f,
-1.0f, 4.0f, -1.0f,
0.0f, -1.0f, 0.0f
};
Kernel kernel = new Kernel(3, 3, edgeKernel);
Figure 7-30 shows the edge kernel's results.
Search WWH ::




Custom Search