资源简介
本人分享一个完整的C#磨皮滤镜代码DEMO,效果很赞,磨皮的同时,保留了一定的细节,跟大家分享一下!

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace TestDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
string startupPath = System.Windows.Forms.Application.StartupPath;
lege_map = new Bitmap(startupPath + @“\map_lege.png“);
}
#region 变量声明
//图像路径
private String curFileName = null;
//当前图像变量
private Bitmap curBitmap = null;
//原始图像变量
private Bitmap srcBitmap = null;
//
ImageFilter imfilter = new ImageFilter();
private Bitmap lege_map = null;
#endregion
#region 图像打开保存模块
//打开图像函数
public void OpenFile()
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = “所有图像文件 | *.bmp; *.pcx; *.png; *.jpg; *.gif;“ +
“*.tif; *.ico; *.dxf; *.cgm; *.cdr; *.wmf; *.eps; *.emf|“ +
“位图( *.bmp; *.jpg; *.png;...) | *.bmp; *.pcx; *.png; *.jpg; *.gif; *.tif; *.ico|“ +
“矢量图( *.wmf; *.eps; *.emf;...) | *.dxf; *.cgm; *.cdr; *.wmf; *.eps; *.emf“;
ofd.ShowHelp = true;
ofd.title = “打开图像文件“;
if (ofd.ShowDialog() == DialogResult.OK)
{
curFileName = ofd.FileName;
try
{
curBitmap = (Bitmap)System.Drawing.Image.FromFile(curFileName);
srcBitmap = new Bitmap(curBitmap);
}
catch (Exception exp)
{ MessageBox.Show(exp.Message); }
}
}
//保存图像函数
public void SaveFile()
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = “PNG文件(*.png)|*.png“;
if (sfd.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image.Save(sfd.FileName ImageFormat.Png);
}
}
//打开图像
private void openBtn_Click(object sender EventArgs e)
{
OpenFile();
if (curBitmap != null)
{
pictureBox1.Image = (Image)curBitmap;
}
}
//保存图像
private void saveBtn_Click(object sender EventArgs e)
{
if (pictureBox1.Image != null)
SaveFile();
}
#endregion
//确定
private void okBtn_Click(object sender EventArgs e)
{
if (pictureBox1.Image != null)
{
int radius = Convert.ToInt32(textBox1.Text.ToString());
if (radius >= 0 && radius <= 20)
{
pictureBox1.Image = (Image)imfilter.SoftSkinFilter(curBitmap
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-12-14 10:07 磨皮滤镜特效\
文件 269090 2015-11-07 15:18 磨皮滤镜特效\Test.png
目录 0 2015-12-14 10:07 磨皮滤镜特效\TestDemo\
目录 0 2015-12-08 09:57 磨皮滤镜特效\TestDemo\TestDemo\
文件 1534 2015-12-08 09:55 磨皮滤镜特效\TestDemo\TestDemo.sln
目录 0 2015-12-08 11:00 磨皮滤镜特效\TestDemo\TestDemo\bin\
目录 0 2015-12-08 10:28 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\
文件 12517 2015-10-21 16:19 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\hisbmp.jpg
文件 3378 2015-12-08 10:00 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\map_lege.png
文件 55808 2015-10-21 15:11 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\pthreadVC2.dll
文件 26112 2015-12-14 10:05 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\TestDemo.exe
文件 56832 2015-12-14 10:05 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\TestDemo.pdb
文件 11600 2015-05-05 11:41 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\TestDemo.vshost.exe
文件 490 2013-03-18 17:00 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\TestDemo.vshost.exe.manifest
文件 24576 2015-05-05 11:50 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\TestDemo_C.dll
文件 406 2015-05-05 11:50 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\TestDemo_C.dll.manifest
文件 260468 2015-05-05 11:50 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\TestDemo_C.ilk
文件 756736 2015-05-05 11:50 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\TestDemo_C.pdb
文件 203776 2015-12-06 14:59 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\ZEffectEngine.dll
文件 88576 2015-12-06 14:58 磨皮滤镜特效\TestDemo\TestDemo\bin\Debug\ZPhotoEngine.dll
目录 0 2015-12-08 11:03 磨皮滤镜特效\TestDemo\TestDemo\bin\Release\
文件 12517 2015-10-21 16:19 磨皮滤镜特效\TestDemo\TestDemo\bin\Release\hisbmp.jpg
文件 3378 2015-12-08 10:00 磨皮滤镜特效\TestDemo\TestDemo\bin\Release\map_lege.png
文件 55808 2015-10-21 15:11 磨皮滤镜特效\TestDemo\TestDemo\bin\Release\pthreadVC2.dll
文件 25600 2015-12-14 10:04 磨皮滤镜特效\TestDemo\TestDemo\bin\Release\TestDemo.exe
文件 48640 2015-12-14 10:04 磨皮滤镜特效\TestDemo\TestDemo\bin\Release\TestDemo.pdb
文件 11600 2015-12-14 10:05 磨皮滤镜特效\TestDemo\TestDemo\bin\Release\TestDemo.vshost.exe
文件 490 2013-03-18 17:00 磨皮滤镜特效\TestDemo\TestDemo\bin\Release\TestDemo.vshost.exe.manifest
文件 24576 2015-05-05 11:50 磨皮滤镜特效\TestDemo\TestDemo\bin\Release\TestDemo_C.dll
文件 203776 2015-12-06 14:59 磨皮滤镜特效\TestDemo\TestDemo\bin\Release\ZEffectEngine.dll
文件 88576 2015-12-06 14:58 磨皮滤镜特效\TestDemo\TestDemo\bin\Release\ZPhotoEngine.dll
............此处省略37个文件信息
- 上一篇:Emgucv3.0(c#)简单入门
- 下一篇:C# 矩阵算法
相关资源
- 超市进销存管理系统 Sqlserver 数据库文
- asp.net C#购物车源代码
- 智慧城市 智能家居 C# 源代码
- MVC model层代码生成器 C#
- c# winform 自动登录 百度账户 源代码
- C#版保龄球记分代码
- C# 使用ListView控件实现图片浏览器(源
- c#记事本 基本功能已经全部实现 包附
- C# TCP通讯组件源代码
- C#版IE浏览器源代码
- C#使用GDI 绘制汽车车速表等量表源代
- 用C#绘制正弦曲线,要用到Form1_Resiz
- 随机抽题系统C#源代码
- 医院业务管理系统(C#源代码)
- C#代码生成器(生成MVC三层代码)
- 远程监控(C#源代码)
- C#Oracle数据库备份
- AssetStudio V0.16.0 源代码 使用VS2019
- 串口调试助手代码(XCOM V2.0)
- C#代码生成工具
- 热血江湖20服务端源代码
- C# 视觉处理代码、神经网络和遗传算
- C#跑马灯代码
- C#最新阿里云短信验证sdk代码
- socket服务端
- C# 立马关机 代码
- kepserver 连接 PLC代码
- VS2012保存时自动格式化代码插件(F
- EPLAN 菜单插件代码
- C# 取色工具源代码(RGB)
评论
共有 条评论