资源简介
使用递归高斯模糊算法实现了高斯模糊,比传统的卷积运算快很多倍,图片越大优势越明显;比FFT快3倍。
目前最快的高斯模糊算法。
基于VS2010,C++源码
代码片段和文件信息
#define WIN32_LEAN_AND_MEAN // trim the excess fat from Windows
/*******************************************************************
* Program: Chapter 7 Bitmap Example 2
* Author: Kevin Hawkins
* Description: 递归高斯模糊 2014/4/23 22:00.
********************************************************************/
////// Defines
#define BITMAP_ID 0x4D42 // the universal bitmap ID
////// Includes
#include // standard Windows app include
#include
#include
#include
#include // standard OpenGL include
#include // OpenGL utilties
#include // OpenGL auxiliary functions
#include “opencv2/highgui/highgui.hpp“
#include “opencv2/imgproc/imgproc.hpp“
#include
using namespace std;
using namespace cv;
////// Global Variables
HDC g_HDC; // global device context
bool fullScreen = false; // true = fullscreen; false = windowed
bool keyPressed[256]; // holds true for keys that are pressed
int width = 512;
int height = 512;
////// Bitmap Information
BITMAPINFOHEADER bitmapInfoHeader; // bitmap info header
unsigned char* bitmapData; // the bitmap data
unsigned char* bitmapData2;
// 高斯半径设置
int step =0;
Point2f srcTri[3];
Point2f dstTri[3];
Mat rot_mat( 2 3 CV_32FC1 );
Mat warp_mat( 2 3 CV_32FC1 );
Mat src warp_dst warp_rotate_dst;
void IMG_GaussBlur(unsigned char* src unsigned char*& dst int width int height float sigma int chan);
// ----------------------------------------------
unsigned int listbase; // display list base
unsigned int CreateBitmapFont(char *fontName int fontSize)
{
HFONT hFont; // windows font
unsigned int base;
base = glGenLists(96); // create storage for 96 characters
if (stricmp(fontName “symbol“) == 0)
{
hFont = CreateFont(fontSize 0 0 0 FW_BOLD FALSE FALSE FALSE SYMBOL_CHARSET
OUT_TT_PRECIS CLIP_DEFAULT_PRECIS ANTIALIASED_QUALITY
FF_DONTCARE | DEFAULT_PITCH fontName);
}
else
{
hFont = CreateFont(fontSize 0 0 0 FW_BOLD FALSE FALSE FALSE ANSI_CHARSET
OUT_TT_PRECIS CLIP_DEFAULT_PRECIS ANTIALIASED_QUALITY
FF_DONTCARE | DEFAULT_PITCH fontName);
}
if (!hFont)
return 0;
Selectobject(g_HDC hFont);
wglUseFontBitmaps(g_HDC 32 96 base);
return base;
}
void ClearFont(unsigned int base)
{
if (base != 0)
glDeleteLists(base 96);
}
void PrintString(unsigned int base char *str)
{
if ((base == 0) || (str == NULL))
return;
glPushAttrib(GL_LIST_BIT);
glListbase(base - 32);
glCallLists(strlen(str) GL_UNSIGNED_BYTE str);
glPopAttrib();
}
void CleanUp()
{
ClearFont(listbase);
}
//----------------------------------------------
// DrawBitmap
// desc: draws the bitmap image data in bitmapImage at the location
// (350300) in the window. (350300) is the lower-left corner
// of the bitmap.
void DrawBitmap(long width long height unsigned
相关资源
- 编译原理用C++消除左递归
- 自编八皇后问题递归、非递归算法
- 经典的分形入门程序-Koch曲线的递归算
- 06.什么是递归.wmv目前数据结构最好的
- 编译原理LL1文法的mfc实现含消除左递
- LL1文法消除左递归编译原理mfc实现完
- 用递归方法求解0/1背包问题
- 编译原理LL(0)C语言小子集源代码
- 对于任意给定的输入串词法记号流进
- 编译原理--递归下降分析程序C++
- 运用递归下降子程序法,实现整数四
- PL0语法分析器(递归子程序法)
- 编译原理语法分析—递归下降分析法
- 编译原理大作业递归下降法
- 非递归预测分析;C++实现LL1文法分析
- 递归下降语法分析器C++实现
- Pascal文法子集的词法分析及递归下降
- 实验三-递归下降子程序分析(本代码
- 递归下降法翻译if then条件语句
- C++ 递归下降布尔表达式
- 递归下降分析法实现LL(1)文法的语
- 编译原理_递归下降分析语法分析_C语
- SNL递归下降语法分析 C++实现
- 用栈非递归方法迷宫找出路
- 分别用栈和递归来实现十进制转换为
- 二叉树非递归遍历源码
- 众数问题c实现
- 24点算法 C++实现
- 汉诺塔非递归算法 用栈 C语言
- C语言 地图染色 非递归 源代码
评论
共有 条评论