Edge Detection-LAPLACE OPERATOR
The Laplace operator can be expressed in a convolution template:
// Laplace operator <br/> // 1. pimagedata image data <br/> // 2. nwidth image width <br/> // 3. nheight image height <br/> // 4. nwidthstep image row size <br/> bool Laplace (unsigned char * pimagedata, int nwidth, int nheight, int nwidthstep) <br/>{< br/> int I = 0; <br/> Int J = 0; <br/> int nvalue = 0; <br/> unsigned char * pline [3] = {null, null, null }; <br/> for (j = 1; j <nheight-1; j ++) <br/> {<br/> pline [0] = pimagedata + nwidthstep * (J-1); <br/> pline [1] = pimagedata + nwidthstep * J; <br/> pline [2] = pimagedata + nwidthstep * (J + 1); <br/> for (I = 1; I <nwidth-1; I ++) <br/> {<br/> nvalue = <br/> pline [0] [I] + pline [1] [I-1] + pline [1] [I + 1] + pline [2] [I]-<br/> pline [1] [I] * 4; <br/> If (nvalue <0) pline [0] [I-1] = 0; <br/> else pline [0] [I-1] = (unsigned char) nvalue; <br/>}< br/> return true; <br/>}