资源简介

借鉴他人的资源进行集合和整理了一下,高斯滤波分为一维高斯滤波和二维高斯滤波,并且和OPENCV的高斯滤波的时间进行对比了一下,比OPENCV的要慢很多

资源截图

代码片段和文件信息

// Image_Processing.cpp : 定义控制台应用程序的入口点。
//

#include “stdafx.h“
#include “smoothing.h“


int _tmain(int argc _TCHAR* argv[])
{

IplImage* src = NULL;
//读取图片
if ((src = cvLoadImage(“D:\\1.png“ 1)) == 0) // test1.jpg einstein.pgm back1.bmp
return -1;

//为图像分配内存
IplImage*image = cvCreateImage(cvSize(src->width src->height) IPL_DEPTH_8U 1);
IplImage*image1 = cvCreateImage(cvSize(src->width src->height) IPL_DEPTH_8U 1);
IplImage* grey_im = cvCreateImage(cvSize(src->width src->height) IPL_DEPTH_8U 1);
//转化成单通道图像再处理
cvCvtColor(src grey_im CV_BGR2GRAY);
cvCopy(grey_im image);
cvCopy(grey_im image1);

double t1 = (double)cvGetTickCount();
gauss_filter_2D((unsigned char*)grey_im->imageData src->width src->height 0.84089642 (unsigned char*)image->imageData);
t1 = (double)cvGetTickCount() - t1;

double t2 = (double)cvGetTickCount();
gauss_filter_2D_optimize((unsigned char*)grey_im->imageData src->width src->height 0.84089642 (unsigned char*)image1->imageData);
t2 = (double)cvGetTickCount() - t2;

// media_filter((unsigned char*)grey_im1->imageData src->width src->height (unsigned char*)image2->imageData);
double t3 = (double)cvGetTickCount();
    cvSmooth(grey_im image CV_GAUSSIAN 7 7 0.84089642);
    t3 = (double)cvGetTickCount() - t3;

//printf(“t1 =  %.1f    t2 = %.1f/n“ t1 / (cvGetTickFrequency()*1000.) t2 / (cvGetTickFrequency()*1000.));
printf(“t1 =  %.1f    t2 = %.1f     t3 = %.1f/n“ t1 / (cvGetTickFrequency()*1000.) t2 / (cvGetTickFrequency()*1000.) t3 / (cvGetTickFrequency()*1000.));
cvNamedWindow(“image“1);
cvShowImage(“image“ image);
cvNamedWindow(“image1“ 1);
cvShowImage(“image1“ image1);
cvWaitKey(0);
cvDestroyWindow(“image“);

return 0;
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      65731  2017-05-25 15:38  Image_Processing\1.png

     文件       1826  2017-05-27 14:00  Image_Processing\Image_Processing\Image_Processing.cpp

     文件       4815  2017-05-27 11:59  Image_Processing\Image_Processing\Image_Processing.vcxproj

     文件       1507  2017-05-27 11:59  Image_Processing\Image_Processing\Image_Processing.vcxproj.filters

     文件       1573  2017-05-25 15:38  Image_Processing\Image_Processing\ReadMe.txt

     文件      13061  2017-05-27 11:41  Image_Processing\Image_Processing\smoothing.cpp

     文件        969  2017-05-27 13:59  Image_Processing\Image_Processing\smoothing.h

     文件        222  2017-05-25 15:38  Image_Processing\Image_Processing\stdafx.cpp

     文件        234  2017-05-25 15:38  Image_Processing\Image_Processing\stdafx.h

     文件        236  2017-05-25 15:38  Image_Processing\Image_Processing\targetver.h

     文件        994  2017-05-25 15:38  Image_Processing\Image_Processing.sln

    ..A..H.     58880  2017-05-27 14:00  Image_Processing\Image_Processing.v12.suo

     目录          0  2017-05-27 14:00  Image_Processing\Image_Processing

     目录          0  2017-05-27 14:05  Image_Processing

----------- ---------  ---------- -----  ----

               150048                    14


评论

共有 条评论