首页 > 代码库 > 拉普拉斯变换 cvLaplace
拉普拉斯变换 cvLaplace
核心函数:cvLaplace
相当于x方向的二阶导数加上y方向的二阶导数
程序:
代码:
#include "cv.h" #include "cxcore.h" #include "highgui.h" #include <iostream> int laplace(int argc,char** argv) { IplImage* src1=cvLoadImage("e:\\picture\\7.jpg",0); IplImage* src2=cvLoadImage("e:\\picture\\8.jpg",0); IplImage* dst1=cvCreateImage(cvGetSize(src1),IPL_DEPTH_16S,src1->nChannels); //注意类型是IPL_DEPTH_16S IplImage* dst2=cvCreateImage(cvGetSize(src2),IPL_DEPTH_16S,src1->nChannels); IplImage* result1=cvCreateImage(cvGetSize(src2),8,src1->nChannels); IplImage* result2=cvCreateImage(cvGetSize(src2),8,src1->nChannels); cvZero(dst1); cvZero(dst2); cvZero(result1); cvZero(result2); cvLaplace(src1,dst1); //相当于x方向的二阶导数加上y方向的二阶导数 cvLaplace(src2,dst2); cvConvertScale(dst1,result1); cvConvertScale(dst2,result2); cvNamedWindow("src1"); cvNamedWindow("src2"); cvNamedWindow("dst1"); cvNamedWindow("dst2"); cvShowImage("src1",src1); cvShowImage("src2",src2); cvShowImage("dst1",result1); cvShowImage("dst2",result2); cvWaitKey(0); cvDestroyWindow("src1"); cvDestroyWindow("src2"); cvDestroyWindow("dst1"); cvDestroyWindow("dst2"); cvReleaseImage(&src1); cvReleaseImage(&src2); cvReleaseImage(&dst1); cvReleaseImage(&dst2); cvReleaseImage(&result1); cvReleaseImage(&result2); return 0; }
本文出自 “flyclc” 博客,请务必保留此出处http://flyclc.blog.51cto.com/1385758/1539842
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。