国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁 > news >正文

網(wǎng)站維護(hù)優(yōu)化網(wǎng)絡(luò)推廣和信息流優(yōu)化一樣么

網(wǎng)站維護(hù)優(yōu)化,網(wǎng)絡(luò)推廣和信息流優(yōu)化一樣么,小程序推廣費(fèi)用一個月需要多少錢,網(wǎng)站建設(shè)收費(fèi)明細(xì)表一、效果展示 二、上面是原展開工具CogPolarUnwrapTool; 第二種方法: 用Blob 和 CogCopyRegionTool 三、 用預(yù)處理工具 加減常數(shù),讓圖片變得更亮點(diǎn) 四、圓展開工具 五、模板匹配 六、代碼分解 1.創(chuàng)建集合和文子顯示工具 CogGraphicCollec…

一、效果展示

二、上面是原展開工具CogPolarUnwrapTool;

第二種方法: 用Blob 和 CogCopyRegionTool

?

三、 用預(yù)處理工具? 加減常數(shù),讓圖片變得更亮點(diǎn)

四、圓展開工具

?

五、模板匹配

六、代碼分解

1.創(chuàng)建集合和文子顯示工具

CogGraphicCollection dt = new CogGraphicCollection();CogGraphicLabel Label;

2.加載工具,并實(shí)例化一個List集合

 dt.Clear();CogPolarUnwrapTool polar = mToolBlock.Tools["CogPolarUnwrapTool1"]as CogPolarUnwrapTool;CogPMAlignTool pma = mToolBlock.Tools["CogPMAlignTool1"]as CogPMAlignTool;List<double> listX = new List<double>();

3.定義圖標(biāo)中的坐標(biāo)嗎,添加集合,排序

 double total = 0;double x, y;for(int i = 0;i < pma.Results.Count;i++){listX.Add(pma.Results[i].GetPose().TranslationX);total += pma.Results[i].GetPose().TranslationY;}y = total / pma.Results.Count;listX.Sort();

4.進(jìn)行傳參,找出之前的x和y坐標(biāo)系,并用參數(shù)接收是否存在缺失

int a = 0;for(int i = 0;i < listX.Count - 1;i++){if((listX[i + 1] - listX[i]) > 50){x = (listX[i + 1] + listX[i]) / 2;y = total / pma.Results.Count;double lastx,lasty;polar.RunParams.GetInputPointFromOutputPoint(polar.InputImage, polar.Region, x, y, out lastx, out lasty);dt.Add(Create(lastx, lasty));a++;}}

5.進(jìn)行判斷是否缺失

 Label = new CogGraphicLabel();if(a > 0){Label.SetXYText(100, 100, "缺失"+a);Label.Color = CogColorConstants.Red;Label.Font = new Font("楷體", 30);dt.Add(Label);}else{Label.SetXYText(100, 100, "OK");Label.Color = CogColorConstants.Green;Label.Font = new Font("楷體", 30);dt.Add(Label);}

6.將上面?zhèn)魅雸A展開的x,y坐標(biāo),進(jìn)行創(chuàng)建圓

private CogCircle Create(double x, double y){CogCircle co = new CogCircle();co.CenterX = x;co.CenterY = y;co.Radius = 20;co.LineWidthInScreenPixels = 6;co.Color = CogColorConstants.Red;dt.Add(co);return co;}

7.輸出

for(int i = 0;i < dt.Count;i++){mToolBlock.AddGraphicToRunRecord(dt[i], lastRecord, "CogIPOneImageTool1.InputImage", "");}

8.代碼All

#region namespace imports
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Cognex.VisionPro;
using Cognex.VisionPro.ToolBlock;
using Cognex.VisionPro3D;
using Cognex.VisionPro.ImageProcessing;
using Cognex.VisionPro.PMAlign;
#endregionpublic class CogToolBlockAdvancedScript : CogToolBlockAdvancedScriptBase
{#region Private Member Variablesprivate Cognex.VisionPro.ToolBlock.CogToolBlock mToolBlock;#endregionCogGraphicCollection dt = new CogGraphicCollection();CogGraphicLabel Label;/// <summary>/// Called when the parent tool is run./// Add code here to customize or replace the normal run behavior./// </summary>/// <param name="message">Sets the Message in the tool's RunStatus.</param>/// <param name="result">Sets the Result in the tool's RunStatus</param>/// <returns>True if the tool should run normally,///          False if GroupRun customizes run behavior</returns>public override bool GroupRun(ref string message, ref CogToolResultConstants result){// To let the execution stop in this script when a debugger is attached, uncomment the following lines.// #if DEBUG// if (System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Break();// #endifdt.Clear();CogPolarUnwrapTool polar = mToolBlock.Tools["CogPolarUnwrapTool1"]as CogPolarUnwrapTool;CogPMAlignTool pma = mToolBlock.Tools["CogPMAlignTool1"]as CogPMAlignTool;List<double> listX = new List<double>();// Run each tool using the RunTool functionforeach(ICogTool tool in mToolBlock.Tools)mToolBlock.RunTool(tool, ref message, ref result);double total = 0;double x, y;for(int i = 0;i < pma.Results.Count;i++){listX.Add(pma.Results[i].GetPose().TranslationX);total += pma.Results[i].GetPose().TranslationY;}y = total / pma.Results.Count;listX.Sort();int a = 0;for(int i = 0;i < listX.Count - 1;i++){if((listX[i + 1] - listX[i]) > 50){x = (listX[i + 1] + listX[i]) / 2;y = total / pma.Results.Count;double lastx,lasty;polar.RunParams.GetInputPointFromOutputPoint(polar.InputImage, polar.Region, x, y, out lastx, out lasty);dt.Add(Create(lastx, lasty));a++;}}Label = new CogGraphicLabel();if(a > 0){Label.SetXYText(100, 100, "缺失"+a);Label.Color = CogColorConstants.Red;Label.Font = new Font("楷體", 30);dt.Add(Label);}else{Label.SetXYText(100, 100, "OK");Label.Color = CogColorConstants.Green;Label.Font = new Font("楷體", 30);dt.Add(Label);}return false;}private CogCircle Create(double x, double y){CogCircle co = new CogCircle();co.CenterX = x;co.CenterY = y;co.Radius = 20;co.LineWidthInScreenPixels = 6;co.Color = CogColorConstants.Red;dt.Add(co);return co;}#region When the Current Run Record is Created/// <summary>/// Called when the current record may have changed and is being reconstructed/// </summary>/// <param name="currentRecord">/// The new currentRecord is available to be initialized or customized.</param>public override void ModifyCurrentRunRecord(Cognex.VisionPro.ICogRecord currentRecord){}#endregion#region When the Last Run Record is Created/// <summary>/// Called when the last run record may have changed and is being reconstructed/// </summary>/// <param name="lastRecord">/// The new last run record is available to be initialized or customized.</param>public override void ModifyLastRunRecord(Cognex.VisionPro.ICogRecord lastRecord){for(int i = 0;i < dt.Count;i++){mToolBlock.AddGraphicToRunRecord(dt[i], lastRecord, "CogIPOneImageTool1.InputImage", "");}}#endregion#region When the Script is Initialized/// <summary>/// Perform any initialization required by your script here/// </summary>/// <param name="host">The host tool</param>public override void Initialize(Cognex.VisionPro.ToolGroup.CogToolGroup host){// DO NOT REMOVE - Call the base class implementation first - DO NOT REMOVEbase.Initialize(host);// Store a local copy of the script hostthis.mToolBlock = ((Cognex.VisionPro.ToolBlock.CogToolBlock)(host));}#endregion}

?

七、polar.RunParams.GetInputPointFromOutputPoint

該方法用于輸出圖像中的坐標(biāo)?(x, y)?轉(zhuǎn)換為輸入圖像中的坐標(biāo)?(lastx, lasty)

  • polar.InputImage?是輸入圖像對象
  • polar.Region?可能是指定的處理區(qū)域
  • x, y?是輸出圖像中的坐標(biāo)
  • out lastx, out lasty?是輸出參數(shù),表示轉(zhuǎn)換后的輸入圖像中的坐標(biāo)。

???????polar.RunParams.GetInputPointFromOutputPoint(

  1. polar.InputImage, // 輸入圖像

  2. polar.Region, // 處理區(qū)域

  3. x, // 輸出圖像中的X坐標(biāo)

  4. y, // 輸出圖像中的Y坐標(biāo)

  5. out lastx, // 輸出:對應(yīng)的輸入圖像中的X坐標(biāo)

  6. out lasty // 輸出:對應(yīng)的輸入圖像中的Y坐標(biāo) );

???????注意事項(xiàng):

  1. 方法的作用:該方法的主要作用是將輸出圖像中的坐標(biāo)映射回輸入圖像中的坐標(biāo),通常用于圖像變換后的逆向坐標(biāo)查找。
  2. 參數(shù)檢查:確保?polar.InputImage?和?polar.Region?已正確初始化,并且?x, y?坐標(biāo)在有效的范圍內(nèi)。
  3. 返回值lastx?和?lasty?是通過?out?參數(shù)返回的,因此調(diào)用后可以直接使用這兩個變量獲取轉(zhuǎn)換后的坐標(biāo)。

八、第二種方法

1.定義值

2. 工具展示

3. Blob設(shè)置

4.CogCopyReigonTool設(shè)置

添加終端鏈接

?

?

?5.CogBlob覆蓋后設(shè)置

6.代碼

#region namespace imports
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Cognex.VisionPro;
using Cognex.VisionPro.ToolBlock;
using Cognex.VisionPro3D;
using Cognex.VisionPro.ImageProcessing;
using Cognex.VisionPro.Blob;
#endregionpublic class CogToolBlockAdvancedScript : CogToolBlockAdvancedScriptBase
{#region Private Member Variablesprivate Cognex.VisionPro.ToolBlock.CogToolBlock mToolBlock;#endregionCogGraphicLabel label = new CogGraphicLabel();/// <summary>/// Called when the parent tool is run./// Add code here to customize or replace the normal run behavior./// </summary>/// <param name="message">Sets the Message in the tool's RunStatus.</param>/// <param name="result">Sets the Result in the tool's RunStatus</param>/// <returns>True if the tool should run normally,///          False if GroupRun customizes run behavior</returns>public override bool GroupRun(ref string message, ref CogToolResultConstants result){// To let the execution stop in this script when a debugger is attached, uncomment the following lines.// #if DEBUG// if (System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Break();// #endifint count = (int) mToolBlock.Inputs["Count"].Value;CogBlobTool blob = mToolBlock.Tools["CogBlobTool2"]as CogBlobTool;// Run each tool using the RunTool functionforeach(ICogTool tool in mToolBlock.Tools)mToolBlock.RunTool(tool, ref message, ref result);int currentCount = blob.Results.GetBlobs().Count;int diff = count - currentCount;string res = "";label.Color = CogColorConstants.Green;label.Font = new Font("宋體", 20);if (diff > 0){res = "缺失:" + diff;label.Color = CogColorConstants.Red;}else{res = "良品";}label.SetXYText(100, 250, res);return false;}#region When the Current Run Record is Created/// <summary>/// Called when the current record may have changed and is being reconstructed/// </summary>/// <param name="currentRecord">/// The new currentRecord is available to be initialized or customized.</param>public override void ModifyCurrentRunRecord(Cognex.VisionPro.ICogRecord currentRecord){}#endregion#region When the Last Run Record is Created/// <summary>/// Called when the last run record may have changed and is being reconstructed/// </summary>/// <param name="lastRecord">/// The new last run record is available to be initialized or customized.</param>public override void ModifyLastRunRecord(Cognex.VisionPro.ICogRecord lastRecord){mToolBlock.AddGraphicToRunRecord(label, lastRecord, "CogIPOneImageTool1.InputImage", "Script");}#endregion#region When the Script is Initialized/// <summary>/// Perform any initialization required by your script here/// </summary>/// <param name="host">The host tool</param>public override void Initialize(Cognex.VisionPro.ToolGroup.CogToolGroup host){// DO NOT REMOVE - Call the base class implementation first - DO NOT REMOVEbase.Initialize(host);// Store a local copy of the script hostthis.mToolBlock = ((Cognex.VisionPro.ToolBlock.CogToolBlock)(host));}#endregion}

http://aloenet.com.cn/news/40270.html

相關(guān)文章:

  • 超大型網(wǎng)站建設(shè)廣州新聞最新消息今天
  • 在58同城做網(wǎng)站怎么樣如何發(fā)布自己的html網(wǎng)站
  • iis7 網(wǎng)站權(quán)限黑帽seo技術(shù)有哪些
  • 網(wǎng)頁編成網(wǎng)站免費(fèi)的云服務(wù)器有哪些
  • 做精美ppt的網(wǎng)站可以免費(fèi)發(fā)布廣告的平臺有哪些
  • 漳州專業(yè)網(wǎng)站建設(shè)公司網(wǎng)絡(luò)營銷屬于什么專業(yè)類型
  • 網(wǎng)頁設(shè)計(jì)制作的流程seo優(yōu)化服務(wù)
  • 佛山網(wǎng)站建設(shè)服務(wù)公司什么搜索引擎搜索最全
  • 黃村網(wǎng)站開發(fā)公司電話東莞營銷型網(wǎng)站建設(shè)
  • b2c商城網(wǎng)站網(wǎng)站搜什么關(guān)鍵詞
  • 黃岐做網(wǎng)站網(wǎng)站建設(shè)技術(shù)托管
  • 宜昌網(wǎng)站推廣關(guān)鍵詞優(yōu)化怎么弄
  • 優(yōu)化企業(yè)網(wǎng)站標(biāo)題河北百度競價(jià)優(yōu)化
  • 備案網(wǎng)站制作北京百度關(guān)鍵詞推廣
  • 企業(yè)注冊在哪個網(wǎng)站申請網(wǎng)絡(luò)營銷的發(fā)展現(xiàn)狀及趨勢
  • 合肥公司網(wǎng)站建設(shè)搜索引擎優(yōu)化排名seo
  • 在上面網(wǎng)站上可以做統(tǒng)計(jì)圖今日深圳新聞最新消息
  • 長沙專業(yè)網(wǎng)站設(shè)計(jì)平臺高質(zhì)量軟文
  • 音樂外鏈網(wǎng)站網(wǎng)站推廣引流最快方法
  • 設(shè)計(jì)素材網(wǎng)站0百度認(rèn)證怎么認(rèn)證
  • 旅行社門店做網(wǎng)站嘛營銷文案
  • 推廣網(wǎng)站排名優(yōu)化seo教程福州seo優(yōu)化
  • 盤縣做會計(jì)兼職的網(wǎng)站愛站網(wǎng)關(guān)鍵詞密度
  • 做網(wǎng)站有效果嗎揚(yáng)州整站seo
  • 江西響應(yīng)式網(wǎng)頁建設(shè)沙洋縣seo優(yōu)化排名價(jià)格
  • 教程網(wǎng)站搭建優(yōu)化網(wǎng)站快速排名軟件
  • 天津百度優(yōu)化武漢seo認(rèn)可搜點(diǎn)網(wǎng)絡(luò)
  • 公司做網(wǎng)站賣東西要什么證太原網(wǎng)站制作優(yōu)化seo公司
  • 網(wǎng)頁設(shè)計(jì)實(shí)訓(xùn)報(bào)告工作內(nèi)容和步驟長春網(wǎng)站建設(shè)方案優(yōu)化
  • 自己做的網(wǎng)站怎么賺錢嗎百度推廣助手客戶端