/* Calculates the image Laplacian: (d2/dx + d2/dy)I */
CVAPI(void) cvLaplace( const CvArr* src, CvArr* dst,
int aperture_size CV_DEFAULT(3) );
拉普拉斯可以用二次导数的形式定义,可假设其离散实现类似于二阶Sobel导数
源图像src既可以是8位(无符号)图像,也可以是32位(浮点)图像
目标图像src必须是16位(有符号)或者32位(浮点)图像
apertureSize与cvSobel()函数的取值一样。1、3、5、7
//cvLaplace
void lapalce(void)
{
IplImage *src=cvLoadImage("lena.jpg");
IplImage *dstx_s=cvCreateImage(cvGetSize(src), IPL_DEPTH_16S, src->nChannels);
IplImage *dsty_s=cvCreateImage(cvGetSize(src), IPL_DEPTH_16S, src->nChannels);
IplImage *dstx_u=cvCreateImage(cvGetSize(src), IPL_DEPTH_8S, src->nChannels);
IplImage *dsty_u=cvCreateImage(cvGetSize(src), IPL_DEPTH_8S, src->nChannels);
if (src == NULL || dstx_s == NULL || dsty_s == NULL || dstx_u == NULL || dsty_u == NULL)
exit(0);
cvLaplace(src, dstx_s, 3);
cvLaplace(src, dsty_s, 7);
cvConvertScale(dstx_s, dstx_u, 1.0, 0);
cvConvertScale(dsty_s, dsty_u, 1.0, 0);
cvNamedWindow("src");
cvNamedWindow("dst3");
cvNamedWindow("dst7");
cvShowImage("src", src);
cvShowImage("dst3", dstx_u);
cvShowImage("dst7", dsty_u);
cvWaitKey(0);
cvReleaseImage(&src);
cvReleaseImage(&dstx_s);
cvReleaseImage(&dsty_s);
cvReleaseImage(&dstx_u);
cvReleaseImage(&dsty_u);
cvDestroyAllWindows();
}