Z-Image-Turbo镜像应用案例:快速生成传统国风、赛博朋克等多种风格画作

核心内容摘要

什么是算力服务器?
程序员相亲奇遇:她用LeetCode题测试我

基于SpringBoot+Vue的非物质文化遗产民间手工艺商城系统的设计与实现

联合编程一setting数据存储方式1,持久化存储方式json格式存储{age:10} 、file文件存储方式File 、StreamReader)二进制存储方式csv存储格式 姓名年龄张三 10Setting存储方式ini存储格式[net]IP

127.

0.

1port8080[data]余伟 20xml存储方式数据库存储方式内存存储 数据类型存储方式 数组、字典、集合等2打开页面--点击Settings.settings接着在winform中添加如下控件在存储按钮下写下如下代码存储数据private void button1_Click(object sender, EventArgs e){Settings set Settings.Default;// 获取配置对象set.name textBox

Text; // 给setting配置表中对应属性进行赋值set.age int.Parse( textBox

Text);set.weight float.Parse( textBox

Text);set.sex bool.Parse(textBox

Text);set.Save();// 保存更改}读取数据private void button2_Click(object sender, EventArgs e){Settings settings Settings.Default;string name settings.name;// 获取配置表数据int age settings.age;float weight settings.weight;bool sex settings.sex;richTextBox

Text name\nage\nweight\nsex;}二ini文件存储和读取1先在桌面创建一个txt文档后缀名改为ini格式编码改成ANSI格式2在winform界面设置如下控件3在读取按钮下写如下代码private void button1_Click(object sender, EventArgs e){//1 获取所有的节点名称//string[] s1 IniAPI.INIGetAllSectionNames(C:\Users\Administrator\Desktop\

ini);//foreach (string item in s

//{// richTextBox

Text item \n;//}//2 获取所有的items//string[] s1 IniAPI.INIGetAllItems(C:\Users\Administrator\Desktop\

ini,net);//foreach (string item in s

//{// richTextBox

Text item \n;//}//3 获取对应节点的键的值 (重要)string s1 IniAPI.INIGetStringValue(C:\Users\Administrator\Desktop\

ini, data,花生,);// richTextBox

Text s1 \n;// 4 获取对应节点的键的值(整型)int a1 IniAPI.GetPrivateProfileInt(C:\Users\Administrator\Desktop\

ini, data, 红豆,

;richTextBox

Text a1 \n;}4在写入按钮下写如下代码private void button2_Click(object sender, EventArgs e){//1 写入指定节点指定的键 (重点)IniAPI.INIWriteValue(C:\Users\Administrator\Desktop\

ini, data, 黄豆,

;//2 删除节点//IniAPI.INIDeleteSection(C:\Users\Administrator\Desktop\

ini, data);//3 删除键//IniAPI.INIDeleteKey(C:\Users\Administrator\Desktop\

ini, net, port);}三图片的读写操作1使用CogImageFileTool 进行读取图片2cogRecordDisplay1 展示记录的 也可以展示图片3在winform添加如下控件在按钮1下输入private void button1_Click(object sender, EventArgs e){//1 创建CogImageFileTool工具CogImageFileTool fileTool new CogImageFileTool();OpenFileDialog dia new OpenFileDialog(); // 文件对话框dia.Filter All Image Files| *.jpg; *.png; *.jpeg; *.ico; *.tif; *.tiff; *.idb; *.bmp;dia.Title 请选择文件;if (dia.ShowDialog()DialogResult.OK){// 可以获取选择文件路径// fileTool.Operator.Open 打开fileTool工具//参数1 路径//参数2 读取fileTool工具//2 使用fileTool工具读取图片fileTool.Operator.Open(dia.FileName,CogImageFileModeConstants.Read);//3 运行工具fileTool.Run();//4 获取输出图 展示cogRecordDisplay

ImagefileTool.OutputImage;//5 自适应大小cogRecordDisplay

Fit();}在按钮2下输入private void button2_Click(object sender, EventArgs e){CogImageFileTool fileTool new CogImageFileTool();// 保存控件展示的图片// 把控件图片赋值给工具的输入图参数中fileTool.InputImage cogRecordDisplay

Image;// fileTool.Operator.Open 打开fileTool工具//参数1 路径//参数2 写入fileTool工具//2 使用fileTool工具写入图片fileTool.Operator.Open(

png, CogImageFileModeConstants.Write);//3 运行工具fileTool.Run();//4 获取输出图 展示// cogRecordDisplay

Image fileTool.OutputImage;//5 自适应大小//5 自适应大小//cogRecordDisplay

Fit();}在按钮3下输入private void button3_Click(object sender, EventArgs e){OpenFileDialog dia new OpenFileDialog(); // 文件对话框dia.Filter All Image Files| *.jpg; *.png; *.jpeg; *.ico; *.tif; *.tiff; *.idb; *.bmp;dia.Title 请选择文件;if (dia.ShowDialog() DialogResult.OK){Bitmap bit Image.FromFile(dia.FileName) as Bitmap; //读取本地图片转成位图// CogImage8Grey image new CogImage8Grey(bit); //转成8位的灰图CogImage24PlanarColor image new CogImage24PlanarColor(bit);//把图片转成彩图cogRecordDisplay

Image image; //展示图片cogRecordDisplay

Fit();}}在按钮4下输入//使用位图进行写入保存private void button4_Click(object sender, EventArgs e){string path Directory.GetCurrentDirectory()\\data;if (!Directory.Exists(path)){Directory.CreateDirectory(path);}//CreateContentBitmap 创建位图内容//参数1 Cognex.VisionPro.Display.CogDisplayContentBitmapConstants.Image 仅仅把图片转成位图了Bitmap map cogRecordDisplay

CreateContentBitmap(Cognex.VisionPro.Display.CogDisplayContentBitmapConstants.Image) as Bitmap;map.Save(path $\\{DateTime.Now:yyyyMMddhhmmss}.png);}四 加载单个PMA工具1先在winform界面加入以下控件2窗体的加载事件CogPMAlignTool pma;private void Form1_Load(object sender, EventArgs e){//加载vpp资源(重点)pma CogSerializer.LoadObjectFromFile(模版匹配.vpp) as CogPMAlignTool;//Subject 属性 工具展示内容cogPMAlignEditV

Subject pma;//MessageBox.Show(加载资源成功);}3在按钮1下写入private void button1_Click(object sender, EventArgs e){if (pmanull){MessageBox.Show(加载资源失败);return;}OpenFileDialog dia new OpenFileDialog(); // 文件对话框dia.Filter All Image Files| *.jpg; *.png; *.jpeg; *.ico; *.tif; *.tiff; *.idb; *.bmp;dia.Title 请选择文件;if (dia.ShowDialog() DialogResult.OK){Bitmap map Image.FromFile(dia.FileName) as Bitmap; //加载路径资源pma.InputImage new CogImage8Grey(map);//转成8位的灰图,赋值给pma的输入图片}}4在按钮2写入// 运行private void button2_Click(object sender, EventArgs e){if(pmanull){MessageBox.Show(加载资源失败);return;}pma.Run();// 运行//展示一条记录//pma.CreateLastRunRecord() 创建上一次的运行记录//SubRecords 子记录cogRecordDisplay

Record pma.CreateLastRunRecord().SubRecords[0];cogRecordDisplay

Fit();}

yy漫画免费登录阅读-yy漫画免费登录阅读应用

百度百家号客服电话人工服务

123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123