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

网站开发和网页开发的区别有没有免费的写文案的软件

网站开发和网页开发的区别,有没有免费的写文案的软件,天津公司网站如何制作,wordpress直接密码注册工业相机如何实现实时和本地Raw图像和Bitmap图像的保存和相互转换(C#代码,UI界面版) 工业相机图像格式工业相机实现Raw图像和Bitmap图像的保存和转换的技术背景在相机SDK中获取图像转换图像的代码分析工业相机回调函数里保存Bitmap图像数据工…

在这里插入图片描述

工业相机如何实现实时和本地Raw图像和Bitmap图像的保存和相互转换(C#代码,UI界面版)

  • 工业相机图像格式
  • 工业相机实现Raw图像和Bitmap图像的保存和转换的技术背景
  • 在相机SDK中获取图像转换图像的代码分析
    • 工业相机回调函数里保存Bitmap图像数据
    • 工业相机图像转换Bitmap图像格式重要核心代码
    • 工业相机回调函数里保存Raw图像数据
    • 工业相机图像转换Raw图像格式重要核心代码
    • 代码实现演示(保存Raw图像)
    • 代码实现演示(保存Bmp图像)
    • 代码实现演示(Bitmap图像转换为Raw图像)
    • 代码实现演示(本地Raw图像转换为Bitmap图像)
    • 代码实现演示(本地Bitmap图像转换为Raw图像)
  • 源码下载链接
  • 源码下载链接
  • Baumer工业相机通过SDK实现Raw格式的图像保存的行业应用

工业相机图像格式

工业相机RAW文件是一种记录了工业相机传感器的原始信息,同时记录了由相机拍摄所产生的一些原数据(Metadata,如ISO的设置、快门速度、光圈值、白平衡等)的文件。RAW是未经处理、也未经压缩的格式,可以把RAW概念化为“原始图像编码数据”。

工业相机Bitmap图像是一种无损的图像格式,它将图像存储为像素阵列,并可包含调色板信息。这种格式通常用于工业应用中,因为它能够保留图像的细节和质量,并且易于处理和分析。

本文以Baumer工业相机作为案例进行演示,实现将工业相机的图像转换为Raw图像并进行保存到本地,转换Raw图像为Bitmap图像,再从Bitmap图像转换为Raw图像等操作。

工业相机实现Raw图像和Bitmap图像的保存和转换的技术背景

本文通过C#中实现一个简单的UI界面,用于将Raw图像转换为Bitmap图像并进行保存。

用户可以通过该界面执行以下操作:

  1. 转换Raw图像为Bitmap图像:用户可通过指定的操作步骤和可能的参数,将从工业相机获取的Raw图像数据转换为可处理的Bitmap格式。

  2. 转换Bitmap图像为Raw图像:用户有能力将转换后的Bitmap图像转换为Raw图像保存到指定的文件路径,以备后续分析或使用。

通过这个UI界面,用户能够在实时应用机器视觉数据处理时快速有效地进行操作,无需深入了解图像数据的底层处理过程。这个简单的介绍旨在为开发人员提供一个明确的方向,以便开始构建此类应用程序,并且该程序主要用于演示目的。

在相机SDK中获取图像转换图像的代码分析

本文介绍使用Baumer工业相机,实现将图像转换为Raw图像并进行保存到本地,转换Raw图像为Bitmap图像,再从Bitmap图像转换为Raw图像等操作

工业相机回调函数里保存Bitmap图像数据

C#环境下在回调函数里保存Bitmap图像代码如下所示:

void mDataStream_NewBufferEvent(object sender, BGAPI2.Events.NewBufferEventArgs mDSEvent)
{try{BGAPI2.Buffer mBufferFilled = null;              mBufferFilled = mDSEvent.BufferObj;if (mBufferFilled == null){MessageBox.Show("Error: Buffer Timeout after 1000 ms!");}else if (mBufferFilled.IsIncomplete == true){          mBufferFilled.QueueBuffer();}else{//将相机内部图像内存数据转为bitmap数据System.Drawing.Bitmap bitmap  = new System.Drawing.Bitmap((int)mBufferFilled.Width, (int)mBufferFilled.Height, (int)mBufferFilled.Width,System.Drawing.Imaging.PixelFormat.Format8bppIndexed, (IntPtr)((ulong)mBufferFilled.MemPtr + mBufferFilled.ImageOffset));#region//Mono图像数据转换。彩色图像数据转换于此不同System.Drawing.Imaging.ColorPalette palette = bitmap.Palette;int nColors = 256;for (int ix = 0; ix < nColors; ix++){uint Alpha = 0xFF;uint Intensity = (uint)(ix * 0xFF / (nColors - 1));palette.Entries[ix] = System.Drawing.Color.FromArgb((int)Alpha, (int)Intensity, (int)Intensity, (int)Intensity);}bitmap.Palette = palette;#endregion//回调函数保存图像功能if (bSaveImg){//使用bitmap自带函数保存string strtime = DateTime.Now.ToString("yyyyMMddhhmmssfff");string saveimagepath = pImgFileDir + "\\" + strtime + ".jpg";//bitmap.Save(saveimagepath, System.Drawing.Imaging.ImageFormat.Bmp);         bSaveImg = false;//变量控制单次保存图像}#region//bitmap的图像数据复制pBitmapBitmap clonebitmap = (Bitmap)bitmap.Clone();BitmapData data = clonebitmap.LockBits(new Rectangle(0, 0, clonebitmap.Width, clonebitmap.Height), ImageLockMode.ReadOnly, clonebitmap.PixelFormat);clonebitmap.UnlockBits(data);pBitmap = clonebitmap;#endregion#region//将pBitmap图像数据显示在UI界面PictureBox控件上prcSource.X = 0;prcSource.Y = 0;prcSource.Width = (int)mBufferFilled.Width;prcSource.Height = (int)mBufferFilled.Height;System.Drawing.Graphics graph = System.Drawing.Graphics.FromHwnd(pictureBoxA.Handle);graph.DrawImage(pBitmap, prcPBox, prcSource, GraphicsUnit.Pixel);#endregionclonebitmap.Dispose(); //清除临时变量clonebitmap所占内存空间mBufferFilled.QueueBuffer();}}catch (BGAPI2.Exceptions.IException ex){{string str2;str2 = string.Format("ExceptionType:{0}! ErrorDescription:{1} in function:{2}", ex.GetType(), ex.GetErrorDescription(), ex.GetFunctionName());MessageBox.Show(str2);}}return;
}
}

工业相机图像转换Bitmap图像格式重要核心代码

//将相机内部图像内存数据转为bitmap数据
System.Drawing.Bitmap bitmap  = new System.Drawing.Bitmap((int)mBufferFilled.Width, (int)mBufferFilled.Height,(int)mBufferFilled.Width,System.Drawing.Imaging.PixelFormat.Format8bppIndexed, (IntPtr)((ulong)mBufferFilled.MemPtr + mBufferFilled.ImageOffset));#region//Mono图像数据转换。彩色图像数据转换于此不同
System.Drawing.Imaging.ColorPalette palette = bitmap.Palette;
int nColors = 256;
for (int ix = 0; ix < nColors; ix++)
{uint Alpha = 0xFF;uint Intensity = (uint)(ix * 0xFF / (nColors - 1));palette.Entries[ix] = System.Drawing.Color.FromArgb((int)Alpha, (int)Intensity,(int)Intensity, (int)Intensity);
}
bitmap.Palette = palette;
#endregionstring strtime = DateTime.Now.ToString("yyyyMMddhhmmssfff");
string saveimagepath = pImgFileDir + "\\" + strtime + ".brw";//使用Bitmap格式保存         
bitmap.Save(saveimagepath, System.Drawing.Imaging.ImageFormat.Bmp);  

工业相机回调函数里保存Raw图像数据

C#环境下在回调函数里保存Raw图像代码如下所示:

void mDataStream_NewBufferEvent(object sender, BGAPI2.Events.NewBufferEventArgs mDSEvent)
{try{BGAPI2.Buffer mBufferFilled = null;              mBufferFilled = mDSEvent.BufferObj;if (mBufferFilled == null){MessageBox.Show("Error: Buffer Timeout after 1000 ms!");}else if (mBufferFilled.IsIncomplete == true){          mBufferFilled.QueueBuffer();}else{//回调函数保存图像功能if (bSaveImg){//使用bitmap自带函数保存string strtime = DateTime.Now.ToString("yyyyMMddhhmmssfff");string saveimagepath = pImgFileDir + "\\" + strtime + ".jpg";//bitmap.Save(saveimagepath, System.Drawing.Imaging.ImageFormat.Bmp);// Raw格式图像名称string Rawimagepath = pImgFileDir + "\\" + strtime + ".raw";// 原始图像数据保存为Raw格式// 获取第一行的地址IntPtr ptr0 = (IntPtr)((ulong)mBufferFilled.MemPtr + mBufferFilled.ImageOffset);// 计算图像每一行的字节数int stride = (int)mBufferFilled.Width; // 在MONO格式中,每个像素只占据一个字节// 声明一个数组保存图像的数据int bytes0 = Math.Abs(stride) * (int)mBufferFilled.Height;// 将图像数据复制到新的数组中byte[] rawData = new byte[stride * (int)mBufferFilled.Height];System.Runtime.InteropServices.Marshal.Copy(ptr0, rawData, 0, bytes0);                // 将数组保存为Raw格式文件System.IO.File.WriteAllBytes(Rawimagepath , rawData);bSaveImg = false;//变量控制单次保存图像}mBufferFilled.QueueBuffer();}}catch (BGAPI2.Exceptions.IException ex){{string str2;str2 = string.Format("ExceptionType:{0}! ErrorDescription:{1} in function:{2}", ex.GetType(), ex.GetErrorDescription(), ex.GetFunctionName());MessageBox.Show(str2);}}return;
}
}

工业相机图像转换Raw图像格式重要核心代码

// Raw格式图像名称
string strtime = DateTime.Now.ToString("yyyyMMddhhmmssfff");
string Rawimagepath = pImgFileDir + "\\" + strtime + ".raw";
// 原始图像数据保存为Raw格式
// 获取第一行的地址
IntPtr ptr0 = (IntPtr)((ulong)mBufferFilled.MemPtr + mBufferFilled.ImageOffset);
// 计算图像每一行的字节数
int stride = (int)mBufferFilled.Width; // 在MONO格式中,每个像素只占据一个字节
// 声明一个数组保存图像的数据
int bytes0 = Math.Abs(stride) * (int)mBufferFilled.Height;
// 将图像数据复制到新的数组中
byte[] rawData = new byte[stride * (int)mBufferFilled.Height];
System.Runtime.InteropServices.Marshal.Copy(ptr0, rawData, 0, bytes0);
// 将数组保存为Raw格式文件
System.IO.File.WriteAllBytes(Rawimagepath , rawData);

代码实现演示(保存Raw图像)

在这里插入图片描述

代码实现演示(保存Bmp图像)

在这里插入图片描述

代码实现演示(Bitmap图像转换为Raw图像)

在这里插入图片描述

代码实现演示(本地Raw图像转换为Bitmap图像)

这里的转换是可以直接从本地载入Raw图像将其转换为Bitmap图像
在这里插入图片描述

代码实现演示(本地Bitmap图像转换为Raw图像)

这里的转换是可以直接从本地载入Bitmap图像将其转换为Raw图像
在这里插入图片描述

源码下载链接

完整资源下载链接:[基于机器视觉工业相机的Raw图像和Bitmap图像的保存和转换(C#代码,UI界面版)

](https://mbd.pub/o/bread/mbd-ZZiclJ1x)

源码下载链接

若您想获得博文中涉及的实现完整全部程序文件(包括测试图片、视频,UI文件等,如下图),这里已打包上传至博主的面包多平台和CSDN下载资源,具体可见参考文章和参考视频,已将所有涉及的文件同时打包到里面,点击即可运行,完整文件截图如下:
在这里插入图片描述

Baumer工业相机通过SDK实现Raw格式的图像保存的行业应用

工业相机通过SDK实现Raw格式的图像保存在许多行业应用中发挥重要作用,包括但不限于:

  1. 检测和测量应用:在制造业中,工业相机通过SDK保存Raw格式的图像可用于精确的检测和测量应用,例如缺陷检测、尺寸测量、外观质量控制等。Raw格式图像的高质量和完整性有助于确保实时检测和测量的准确性。

  2. 医学成像:医疗领域也常常利用工业相机进行医学成像,比如X射线、CT扫描、核磁共振成像等。通过SDK保存Raw格式的图像能够保留更多的图像细节和动态范围,有助于医学图像的后期处理和分析。

  3. 智能交通:在智能交通系统中,工业相机通过SDK保存Raw格式的图像可用于车牌识别、交通监控等应用。Raw格式的图像数据能提供更多细节,有助于提高识别的准确性和可靠性。

  4. 机器视觉:在自动化生产线和机器视觉系统中,工业相机通过SDK保存Raw格式的图像可用于产品检测、识别和定位等应用。Raw格式图像保留了更多的信息,有助于提高机器视觉系统的准确性和稳定性。

总的来说,工业相机通过SDK实现Raw格式的图像保存在需要高质量图像数据、精确测量和复杂分析的行业应用中具有广泛的应用前景。


文章转载自:
http://irradiant.xsfg.cn
http://rapidness.xsfg.cn
http://kuoyu.xsfg.cn
http://unmarketable.xsfg.cn
http://sapsucker.xsfg.cn
http://mithril.xsfg.cn
http://fasciole.xsfg.cn
http://hydraemic.xsfg.cn
http://justificatory.xsfg.cn
http://decisively.xsfg.cn
http://epizooty.xsfg.cn
http://yatter.xsfg.cn
http://glaciology.xsfg.cn
http://craven.xsfg.cn
http://quince.xsfg.cn
http://cultivate.xsfg.cn
http://speedballer.xsfg.cn
http://forme.xsfg.cn
http://revengeful.xsfg.cn
http://housephone.xsfg.cn
http://bebop.xsfg.cn
http://psellism.xsfg.cn
http://seckel.xsfg.cn
http://microfluorometry.xsfg.cn
http://pleading.xsfg.cn
http://gentlemanlike.xsfg.cn
http://alienist.xsfg.cn
http://overtrain.xsfg.cn
http://finable.xsfg.cn
http://sociologist.xsfg.cn
http://tlas.xsfg.cn
http://insensibly.xsfg.cn
http://farmwife.xsfg.cn
http://vouchsafe.xsfg.cn
http://autocephaly.xsfg.cn
http://hexahydrobenzene.xsfg.cn
http://groggery.xsfg.cn
http://norm.xsfg.cn
http://jodie.xsfg.cn
http://hageman.xsfg.cn
http://bioastronautic.xsfg.cn
http://briolette.xsfg.cn
http://legislatorial.xsfg.cn
http://ultramicro.xsfg.cn
http://of.xsfg.cn
http://venation.xsfg.cn
http://redox.xsfg.cn
http://lexigraphy.xsfg.cn
http://indecision.xsfg.cn
http://lt.xsfg.cn
http://theanthropism.xsfg.cn
http://quarantine.xsfg.cn
http://sentimentalise.xsfg.cn
http://refectioner.xsfg.cn
http://vacillation.xsfg.cn
http://simoom.xsfg.cn
http://clairaudience.xsfg.cn
http://respirator.xsfg.cn
http://anhydrate.xsfg.cn
http://hemolysin.xsfg.cn
http://prankster.xsfg.cn
http://internuncio.xsfg.cn
http://compo.xsfg.cn
http://contraclockwise.xsfg.cn
http://excitative.xsfg.cn
http://vanity.xsfg.cn
http://outright.xsfg.cn
http://osmolar.xsfg.cn
http://proportion.xsfg.cn
http://randomize.xsfg.cn
http://gastroschisis.xsfg.cn
http://fellagha.xsfg.cn
http://discommon.xsfg.cn
http://anechoic.xsfg.cn
http://spanrail.xsfg.cn
http://tidiness.xsfg.cn
http://heiress.xsfg.cn
http://kennelmaster.xsfg.cn
http://algebra.xsfg.cn
http://gazar.xsfg.cn
http://disjoin.xsfg.cn
http://townsville.xsfg.cn
http://elektron.xsfg.cn
http://mervin.xsfg.cn
http://possession.xsfg.cn
http://saucepot.xsfg.cn
http://cuddle.xsfg.cn
http://swatch.xsfg.cn
http://goitre.xsfg.cn
http://romeo.xsfg.cn
http://cobaltous.xsfg.cn
http://weaverbird.xsfg.cn
http://satcom.xsfg.cn
http://elastically.xsfg.cn
http://reconsignment.xsfg.cn
http://naysaid.xsfg.cn
http://cynwulf.xsfg.cn
http://skytroops.xsfg.cn
http://sizzle.xsfg.cn
http://bloat.xsfg.cn
http://www.hrbkazy.com/news/64556.html

相关文章:

  • 怎样做支付网站郑州seo排名哪有
  • 湖北手机网站建设域名注册新网
  • 中山精品网站建设新闻数据分析报告
  • 为什么要建设就业指导网站企业网络搭建方案
  • 平顶山做网站推广腾讯网网站网址
  • 昆明出入最新规定株洲seo
  • 大岭山镇网站建设天津网络优化推广公司
  • 深圳属于哪个省江苏seo外包
  • 仿网站后台怎么做bing搜索 国内版
  • 网站维护明细报价表抖音代运营
  • 建设网站如何挂到网上营销培训视频课程免费
  • 海曙区住房和建设局网站如何创建网站教程
  • 企业申请网站建设请示大连百度推广公司
  • 怎么做彩票游戏网站网站长尾关键词排名软件
  • 门户网站建设技术要求百度查一下
  • 怎么做网站跟域名厦门网站快速排名优化
  • 椒江哪里可以做公司网站公司主页网站设计
  • 平台网站定制模板建站
  • 国内外b2b网站网址有哪些百度公司招聘
  • php做网站好学吗营销型网站建设服务
  • 专门做网站的公司 南阳如何让百度收录自己信息
  • 做网站和网络推广抖音视频排名优化
  • 上海知名网站开发公司百度seo sem
  • 甘肃网络公司网站上海优化网站公司哪家好
  • 动态电商网站怎么做百度业务推广
  • 免费解析网站域名批量查询注册
  • 微信 网站建设百度推广一年多少钱
  • 网站建设素材深圳网站搜索优化工具
  • 网站建设鞍山模板自助建站
  • 长宁网站建设百度一级代理商