码迷,mamicode.com
首页 > 其他好文 > 详细

拉普拉斯变换 cvLaplace

时间:2014-08-14 17:01:59      阅读:274      评论:0      收藏:0      [点我收藏+]

标签:opencv 拉普拉斯变换 cvlaplace

核心函数:cvLaplace

相当于x方向的二阶导数加上y方向的二阶导数

程序:

bubuko.com,布布扣

代码:

#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

拉普拉斯变换 cvLaplace,布布扣,bubuko.com

拉普拉斯变换 cvLaplace

标签:opencv 拉普拉斯变换 cvlaplace

原文地址:http://flyclc.blog.51cto.com/1385758/1539842

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!