当前位置: 首页 > wzjs >正文

南通做网站的花云东莞网站建设哪家公司好

南通做网站的花云,东莞网站建设哪家公司好,彩票计划网站怎么做,wordpress strip_tags目录 1 简介 2 算法原理 3 代码实现 4 演示Demo 4.1 开发环境 4.2 功能介绍 4.3 下载地址 参考 1 简介 BEEPS(Bias Elimination in Edge-Preserving Smoothing) 是一种基于偏微分方程(PDE)的边缘保留平滑滤波算法。它能够…

目录

1 简介

2 算法原理

3 代码实现

4 演示Demo

4.1 开发环境

4.2 功能介绍

4.3 下载地址

参考


1 简介

        BEEPS(Bias Elimination in Edge-Preserving Smoothing) 是一种基于偏微分方程(PDE)的边缘保留平滑滤波算法。它能够在平滑图像的同时有效消除偏差(Bias),从而更好地保留边缘和细节。BEEPS 滤波算法广泛应用于图像去噪、图像增强和医学图像处理等领域。

2 算法原理

        BEEPS 滤波的核心思想是通过引入偏差消除项,改进传统的边缘保留平滑算法(如各向异性扩散)。其数学模型基于以下偏微分方程:

\frac{\vartheta{I}}{\vartheta{t}} = div(c(|\triangledown I|)* \triangledown I) - \lambda (I-I_0)

        其中

  • I 是图像。

  • I 是图像的梯度。

  • c(∣∇I∣) 是扩散系数,控制滤波的强度。

  • \lambda是偏差消除项的权重。

  • I_0是原始图像

        扩散系数c(∣∇I∣) 通常定义为:

c(|\triangledown I|) = \frac{1}{1+(\frac{|\triangledown I|}{k})^2}

        或

c(|\triangledown I|) = -exp(-(\frac{|\triangledown I|}{k})^2)

        其中,k 是一个控制边缘敏感度的参数。

        算法步骤:

  1. 计算图像的梯度 ∇I

  2. 根据梯度计算扩散系数 c(∣∇I∣)。

  3. 使用扩散系数更新图像像素值。

  4. 重复上述步骤,直到达到指定的迭代次数。

3 代码实现

        Anisotropic滤波算法的的C语言实现代码如下

double Gaussian(int u, int v, double sigma)
{int t = -(u - v) * (u - v);return exp((double)t / sigma);
}
int BEEPSHorizontal(unsigned char* srcPtr, int width, int height, unsigned char* outData, double sigma, int c)
{unsigned char* F = (unsigned char*)malloc(sizeof(unsigned char) * width * height);int *s = (int*)malloc(sizeof(int) * width);int *v = (int*)malloc(sizeof(int) * width);int pos = 0, X = 0, Y = 0;int p = 0;memset(F, 0, width * height);memset(outData, 0, width * height);memset(s, 0, width);memset(v, 0, width);unsigned char* D = outData;for (int y = 0; y < height; y++){for (int x = 0; x < width; x++){X = width - 1 - x;Y = height - 1 - y;if (x == 0){pos = x + y * width;F[pos] = srcPtr[pos];s[0] = srcPtr[pos];p = X;pos = p + Y * width;v[p] = srcPtr[pos];D[pos] = srcPtr[pos];}else{p = x;pos = p + y * width;s[p] = (int)(10.0 * Gaussian(srcPtr[pos], F[pos - 1], sigma));F[pos] = CLIP3((((100 - s[p] * c) * srcPtr[pos] + s[p] * c * F[pos - 1]) / 100), 0, 255);p = X;pos = p + Y * width;v[p] = (int)(10.0 * Gaussian(srcPtr[pos], D[pos + 1], sigma));D[pos] = CLIP3((((100 - v[p] * c) * srcPtr[pos] + v[p] * c * D[pos + 1]) / 100), 0, 255);}}}for (int i = 0; i < height * width; i++){D[i] = CLIP3(((10 * F[i] - (10 - c) * (srcPtr[i]) + 10 * D[i]) / (10 + c)), 0, 255);}free(F);free(s);free(v);return 0;
}int BEEPSVertical(unsigned char* srcPtr, int width, int height, unsigned char* outData, double sigma, int c)
{unsigned char* F = (unsigned char*)malloc(sizeof(unsigned char) * width * height);unsigned char* D = outData;int* s = (int*)malloc(sizeof(int) * height);int* v = (int*)malloc(sizeof(int) * height);int pos = 0, X = 0, Y = 0;memset(s, 0, height);memset(v, 0, height);for (int x = 0; x < width; x++){for (int y = 0; y < height; y++){X = width - 1 - x;Y = height - 1 - y;if (y == 0){pos = x + y * width;F[pos] = srcPtr[pos];s[y] = srcPtr[pos];pos = X + Y * width;D[pos] = srcPtr[pos];v[Y] = srcPtr[pos];}else{pos = x + y * width;s[y] = (int)(10.0 * Gaussian(srcPtr[pos], F[pos - width], sigma));F[pos] = CLIP3((((100 - s[y] * c) * srcPtr[pos] + s[y] * c * F[pos - width]) / 100), 0, 255);pos = X + Y * width;v[Y] = (int)(10.0 * Gaussian(srcPtr[pos], D[pos + width], sigma));D[pos] = CLIP3((((100 - v[Y] * c) * srcPtr[pos] + v[Y] * c * D[pos + width]) / 100), 0, 255);}}}for (int i = 0; i < height*width; i++){D[i] = CLIP3(((10 * F[i] - (10 - c) * (srcPtr[i]) + 10 * D[i]) / (10 + c)), 0, 255);}free(F);free(s);free(v);return 0;
}void BEEPSProcess(unsigned char* srcPtr, int width, int height, float sigma, float c)
{float* GMAP = (float*)malloc(sizeof(float) * 256 * 256);for (int j = 0; j < 256; j++){for (int i = 0; i < 256; i++){GMAP[i + j * 256] = Gaussian(i, j, sigma);}}sigma = sigma > 50 ? 50 : sigma;sigma = sigma * sigma * 2.0f;float Lamba = 10.0f * (float)(1 - (sqrt(2.0f * c * c + 1) - 1) / (c * c));unsigned char* pSrc = srcPtr;unsigned char* hValue = (unsigned char*)malloc(sizeof(unsigned char) * width * height);unsigned char* vValue = (unsigned char*)malloc(sizeof(unsigned char) * width * height);unsigned char* dstValue = (unsigned char*)malloc(sizeof(unsigned char) * width * height);BEEPSHorizontal(pSrc, width, height, hValue, sigma, Lamba);BEEPSVertical(hValue, width, height, vValue, sigma, Lamba);BEEPSVertical(pSrc, width, height, hValue, sigma, Lamba);BEEPSHorizontal(hValue, width, height, dstValue, sigma, Lamba);for (int i = 0; i < width * height; i++){*pSrc++ = CLIP3(((vValue[i] + dstValue[i]) / 2), 0, 255);}free(hValue);free(vValue);free(dstValue);
}int mxBeepsFilter(unsigned char* srcData, int nWidth, int nHeight, int nStride, float delta, float delta_s)
{if (srcData == NULL){return 0;}if (delta == 0 || delta_s == 0)return 0;unsigned char* yData = (unsigned char*)malloc(sizeof(unsigned char) * nWidth * nHeight);unsigned char* cbData = (unsigned char*)malloc(sizeof(unsigned char) * nWidth * nHeight);unsigned char* crData = (unsigned char*)malloc(sizeof(unsigned char) * nWidth * nHeight);unsigned char* pSrc = srcData;int Y, CB, CR;unsigned char* pY = yData;unsigned char* pCb = cbData;unsigned char* pCr = crData;for (int j = 0; j < nHeight; j++){for (int i = 0; i < nWidth; i++){RGBToYCbCr(pSrc[2], pSrc[1], pSrc[0], &Y, &CB, &CR);*pY = Y;*pCb = CB;*pCr = CR;pY++;pCb++;pCr++;pSrc += 4;}}BEEPSProcess(yData, nWidth, nHeight, delta, delta_s);pSrc = srcData;pY = yData;pCb = cbData;pCr = crData;int R, G, B;for (int j = 0; j < nHeight; j++){for (int i = 0; i < nWidth; i++){YCbCrToRGB(*pY, *pCb, *pCr, &R, &G, &B);pSrc[0] = B;pSrc[1] = G;pSrc[2] = R;pY++;pCb++;pCr++;pSrc += 4;}}free(yData);free(cbData);free(crData);return 0;
}

4 演示Demo

4.1 开发环境

  • Windows 10 Pro x64

  • Visual Studio 2015

4.2 功能介绍

        演示程序主界面如下图所示,具有图像读取、显示、保存、双边滤波、表面模糊、导向滤波、局部均值方差滤波、各向异性扩散滤波、Smart Blur滤波、MeanShift滤波、BEEPS滤波、处理耗时等功能

原图

滤波效果图

4.3 下载地址

        开发环境:

  • Windows 10 pro x64

  • Visual Studio 2015

        下载地址:图像保边滤波之BEEPS滤波算法Demo

参考

        图像视频滤镜与人像美颜美妆算法详解. 胡耀武、谭娟、李云夕. 电子工业出版社、2020-07

http://www.dtcms.com/wzjs/289634.html

相关文章:

  • 个人网站作品企业营销战略
  • 网站到期忘记续费seo推广要多少钱
  • 苏州招聘网站建设巨量算数官方入口
  • 做软件需要网站有哪些百度问答下载安装
  • 丹东建设安全监督网站搜索引擎有哪些网站
  • 建站 网站程序有哪些哪家建设公司网站
  • 宁波网站建设培训哪家好株洲网站设计
  • 用asp做宠物网站页面淘宝关键词查询工具哪个好
  • 网站建设前期分析b站推出的短视频app哪个好
  • ip开源网站FPGA可以做点什么怎么做好网络推广销售
  • 郑州低价网站制作搜索引擎优化是什么意思
  • 成都网站建设四川冠辰seo查询官方网站
  • 宁波seo营销
  • 百度网站小程序怎么做网络营销章节测试答案
  • 网站建设公司注册想做百度推广找谁
  • 成人做暧视频观看网站网络广告的形式有哪些?
  • 怎么进入wordpress后台改苏州关键词优化搜索排名
  • 品牌网站建设源码seo下载站
  • 自适应型网站建设多少钱郑州网站优化哪家好
  • 宜兴做网站的公司有哪些女生学电子商务好吗
  • 建设网站需要的ftp资源谷歌seo公司
  • 自己做的网站竞价优化武汉seo建站
  • 365房产南京网站爱站网长尾关键词挖掘工具
  • 固安建设网站百度快速seo优化
  • 公章电子版在线制作网站刷关键词要刷大词吗
  • 企业网站建设建议郑州百度推广公司
  • 海洋cms怎么做电影网站网站推广和优化的原因网络营销
  • 做视频上传可以赚钱的网站阿里指数查询手机版
  • 类似12306网站开发免费开源代码网站
  • 微商代理0元0投入关键词排名优化