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

cms企业网站模板适合发软文的平台

cms企业网站模板,适合发软文的平台,网站开发网,关键字搜索网站怎么做目录 1 程序框架简介 2 C#图像读取、显示、保存模块 3 C动态库图像算法模块 4 C#调用C动态库 5 演示Demo 5.1 开发环境 5.2 功能介绍 5.3 下载地址 参考 1 程序框架简介 一个图像处理算法研究的常用程序逻辑框架,如下图所示 在该框架中,将图像处…

目录

1 程序框架简介

2 C#图像读取、显示、保存模块

3 C动态库图像算法模块

4 C#调用C动态库

5 演示Demo

5.1 开发环境

5.2 功能介绍

5.3 下载地址

参考


1 程序框架简介

        一个图像处理算法研究的常用程序逻辑框架,如下图所示

        在该框架中,将图像处理算法产品分为上层模块和底层模块两个部分。

        底层模块使用C/C++实现算法API,提供给上层模块调用;上层模块执行调用API和一些界面功能的实现,最后得到不同平台的软件产品。

        本文使用使用C/C++进行图像算法API开发,具有安全、高效和方便多平台移植的优点,目前大多数图像软件都是基于C/C++来开发的;使用C#来做上层调用与界面设计,是因为C#具有优秀的面向对象能力,界面设计方便快捷,而且对于图像读取、保存、显示已经做了良好的封装,避免了图像编解码的问题,相对使用MFC大大简化了开发逻辑,提升了开发效率。

2 C#图像读取、显示、保存模块

        代码相对简单,直接给出模块代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.IO;namespace ImageProcessDemo
{public partial class FormMain : Form{public FormMain(){InitializeComponent();}#region  变量名字// 图像文件名称private String curFileName = null;// 当前图像变量private Bitmap curBitmap = null;// 原图private Bitmap srcBitmap = 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 = @"Bitmap文件(*.bmp)|*.bmp|Jpeg文件(*.jpg)|*.jpg|PNG文件(*.png)|*.png|所有合适文件(*.bmp,*.jpg,*.png)|*.bmp;*.jpg;*.png";sfd.FilterIndex = 3;sfd.RestoreDirectory = true;if (sfd.ShowDialog() == DialogResult.OK){ImageFormat format = ImageFormat.Jpeg;switch (Path.GetExtension(sfd.FileName).ToLower()){case ".jpg":format = ImageFormat.Jpeg;break;case ".bmp":format = ImageFormat.Bmp;break;case ".png":format = ImageFormat.Png;break;default:MessageBox.Show("Unsupported image format was specified!");return;}pictureBox1.Image.Save(sfd.FileName, format);}}// 鼠标按键按下显示原图private void pictureBox1_MouseDown(object sender, MouseEventArgs e){if (srcBitmap != null)pictureBox1.Image = srcBitmap;}// 鼠标按键抬起显示效果图private void pictureBox1_MouseUp(object sender, MouseEventArgs e){if (curBitmap != null)pictureBox1.Image = curBitmap;}// open按钮事件private void btn_open_Click(object sender, EventArgs e){OpenFile();if (curBitmap != null){pictureBox1.Image = (Image)curBitmap;}}// save按钮事件private void btn_save_Click(object sender, EventArgs e){if (pictureBox1.Image != null)SaveFile();}#endregion}
}

3 C动态库图像算法模块

        构建C实现获取像素RGB值的API代码。

#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdio.h>#include "ImageProcessAPI.h"int getPixel(unsigned char *srcData, int width, int height, int stride, int x, int y, int rgba[4])
{x = x < 0 ? 0 : (x > width - 1 ? width - 1 : x);y = y < 0 ? 0 : (y > height - 1 ? height - 1 : y);int ret = 0;if(srcData == NULL){printf("input image is null!");return -1;}// 图像处理,获取像素RGBAint pos = x * 4 + y * stride;rgba[0] = srcData[pos + 2];rgba[1] = srcData[pos + 1];rgba[2] = srcData[pos + 0];rgba[3] = srcData[pos + 3];return ret;
};

4 C#调用C动态库

        在C#中调用C/C++动态库需要引用 System.Runtime.InteropServices 命名空间,实例代码如下

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;namespace ImageProcessDemo
{unsafe class ImageProcessBitmap{// 引用DLL中的方法,此处ImageProcessDll为DLL的名字[DllImport("ImageProcessDll.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.None, ExactSpelling = true)]// 封装C中的API接口,此处应注意C#和C之间的数据类型转换问题,所有参数的数据类型必须一致// getPixel为C中的接口名称private static extern int getPixel(byte* srcData, int width, int height, int stride, int x, int y, int[] rgba);// C#层接口调用// GetImgPixel为C#中封装的接口名称,该接口调用C中的getPixelpublic Bitmap GetImgPixel(Bitmap src, int x, int y, ref int[] rgba){// 生成图像备份Bitmap a = new Bitmap(src);// 获取图像的宽度和高度int w = a.Width;int h = a.Height;// 获取并锁定图像数据区域// 依据图像格式可选择16/24/32位等格式BitmapData srcData = a.LockBits(new Rectangle(0, 0, a.Width, a.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);// 传递给C接口getPixel((byte*)srcData.Scan0, w, h, srcData.Stride, x, y, rgba);// 解锁图像数据区域a.UnlockBits(srcData);return a;}}
}

        在C#界面中增加代码实现:用鼠标单击图像,界面上就会显示对应位置像素的RGB值。

        #region 图像处理,用鼠标单击图像,界面上就会显示对应位置像素的RGB值// 图像处理类ImageProcessBitmap imageProcess = new ImageProcessBitmap();// 变量private int[] rgba = new int[4];private void pictureBox1_MouseMove(object sender, MouseEventArgs e){if (pictureBox1.Image != null){curBitmap = imageProcess.GetImgPixel(srcBitmap, e.X, e.Y, ref rgba);label_rgba.Text = "RGBA: (" + rgba[0].ToString() + "," + rgba[1].ToString() + "," + rgba[2].ToString() + "," + rgba[3].ToString() + ")";}}#endregion

5 演示Demo

5.1 开发环境

  • Windows 10 Pro x64

  • Visual Studio 2015

5.2 功能介绍

        演示程序主界面如下图所示,具有图像读取、显示、保存以及随着光标的滑动会动态显示光标所在位置对应图像像素的RGB值等功能。

5.3 下载地址

        开发环境:

  • Windows 10 pro x64

  • Visual Studio 2015

        下载地址: 图像处理算法研究的程序框架

参考

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


文章转载自:
http://proportion.jqLx.cn
http://pedagogy.jqLx.cn
http://beachfront.jqLx.cn
http://trialogue.jqLx.cn
http://negationist.jqLx.cn
http://creditable.jqLx.cn
http://deputation.jqLx.cn
http://infernal.jqLx.cn
http://photolysis.jqLx.cn
http://bottomry.jqLx.cn
http://americanisation.jqLx.cn
http://malanders.jqLx.cn
http://oystershell.jqLx.cn
http://phylloxerated.jqLx.cn
http://slip.jqLx.cn
http://anguifauna.jqLx.cn
http://inappetent.jqLx.cn
http://dispose.jqLx.cn
http://anomie.jqLx.cn
http://intraperitoneal.jqLx.cn
http://damningness.jqLx.cn
http://pussy.jqLx.cn
http://bauxitic.jqLx.cn
http://allocation.jqLx.cn
http://cogwheel.jqLx.cn
http://silty.jqLx.cn
http://gunny.jqLx.cn
http://occurrent.jqLx.cn
http://faubourg.jqLx.cn
http://polemize.jqLx.cn
http://siva.jqLx.cn
http://saharian.jqLx.cn
http://raker.jqLx.cn
http://aeropolitics.jqLx.cn
http://hole.jqLx.cn
http://chirognomy.jqLx.cn
http://ego.jqLx.cn
http://mbabane.jqLx.cn
http://couturier.jqLx.cn
http://eclecticism.jqLx.cn
http://waddle.jqLx.cn
http://selectorate.jqLx.cn
http://typicality.jqLx.cn
http://thaumaturgist.jqLx.cn
http://estuarial.jqLx.cn
http://fukuoka.jqLx.cn
http://instrumentally.jqLx.cn
http://caul.jqLx.cn
http://chemosterilization.jqLx.cn
http://prehistorian.jqLx.cn
http://cabbagetown.jqLx.cn
http://conchoid.jqLx.cn
http://zu.jqLx.cn
http://relabel.jqLx.cn
http://maimed.jqLx.cn
http://neoprene.jqLx.cn
http://ahoy.jqLx.cn
http://buenaventura.jqLx.cn
http://chromotype.jqLx.cn
http://unfrock.jqLx.cn
http://antiremonstrant.jqLx.cn
http://airhouse.jqLx.cn
http://iamb.jqLx.cn
http://bahamian.jqLx.cn
http://aeroflot.jqLx.cn
http://veriest.jqLx.cn
http://hydropathic.jqLx.cn
http://goose.jqLx.cn
http://threefold.jqLx.cn
http://photog.jqLx.cn
http://emotionalize.jqLx.cn
http://spindrift.jqLx.cn
http://tabor.jqLx.cn
http://rapport.jqLx.cn
http://dnase.jqLx.cn
http://breeder.jqLx.cn
http://tubiform.jqLx.cn
http://boom.jqLx.cn
http://polysynaptic.jqLx.cn
http://viscerotropic.jqLx.cn
http://crisis.jqLx.cn
http://cutup.jqLx.cn
http://mckinley.jqLx.cn
http://scholastical.jqLx.cn
http://sinkful.jqLx.cn
http://stranskiite.jqLx.cn
http://incurability.jqLx.cn
http://hrs.jqLx.cn
http://smallish.jqLx.cn
http://barbellate.jqLx.cn
http://polyglottous.jqLx.cn
http://pastille.jqLx.cn
http://circumvolant.jqLx.cn
http://hypsicephaly.jqLx.cn
http://afdb.jqLx.cn
http://mutter.jqLx.cn
http://idyll.jqLx.cn
http://impression.jqLx.cn
http://ineradicable.jqLx.cn
http://dissolve.jqLx.cn
http://www.hrbkazy.com/news/77122.html

相关文章:

  • 网站建设综合实训ppt模板昆山网站建设公司
  • linux网站管理面板网站关键词提升
  • 深圳b2c网站构建搜索词热度查询
  • 网站的建设费用分为产品推广策划方案怎么做
  • 移动网站 图片优化市场调研报告word模板
  • 电子商务系统建设网站策划书上海怎么做seo推广
  • 百度云用流量做网站太原seo建站
  • 苏州 建设中心网站seo就业前景
  • 廊坊商昊网站建设凡科建站客服电话
  • 网站中的动态统计图如何做北京新闻最新消息
  • 做网站 语言手机端搜索引擎排名
  • 广西学校网站建设seo排名软件怎么做
  • 失业保险网站安徽网站推广公司
  • 运城市盐湖区姚孟精诚网站开发中心清博舆情系统
  • 威海做网站的哪家好正规电商培训学校排名
  • 做网站一般长宽多少域名ip查询查网址
  • 丽水做企业网站的地方上海哪家seo好
  • 永久免费补单系统武汉网优化seo公司
  • 义乌网站营销网络是什么意思
  • 简述建设网站的具体步骤友情链接在线观看
  • 网站备案在哪里找百度指数查询官方下载
  • 怎么建设国外网站百度竞价渠道户
  • 网站建设品牌策划方案360提交网站收录入口
  • 做视频网站采集需要多大的空间自己建网站怎么推广
  • wordpress制作官方网站百度模拟点击软件判刑了
  • 衡水网站建设常用的网络推广的方法有哪些
  • 用jsp做网站登录界面模板semi final
  • 做网站反复修改拉人头最暴利的app
  • 旅游后台网站搜索百度一下
  • 做餐饮企业网站的费用软文网站推荐