HALCON示例程序measure_chip.hdev芯片封裝檢測

HALCON示例程序measure_chip.hdev芯片封裝檢測

示例程序源碼(加注釋)

  • 關于顯示類函數解釋
    dev_update_off ()
    read_image (Image, ‘die_on_chip’)
    get_image_size (Image, Width, Height)
    dev_close_window ()
    dev_open_window (0, 0, Width * 2, Height * 2, ‘light gray’, WindowID)
    dev_set_part (0, 0, Height - 1, Width - 1)
    dev_set_line_width (3)
    dev_set_color (‘white’)
    dev_set_draw (‘margin’)
    dev_display (Image)
    set_display_font (WindowID, 16, ‘mono’, ‘true’, ‘false’)
    dev_set_line_width (2)
    dev_set_draw (‘fill’)
  • 快速二值化
    fast_threshold (Image, Region, 120, 255, 20)
  • 開運算
    opening_rectangle1 (Region, RegionOpening, 4, 4)
  • 分割連通域
    connection (RegionOpening, ConnectedRegions)
  • 填充孔洞
    fill_up (ConnectedRegions, RegionFillUp)
  • 通過矩形度與面積篩選區域
    select_shape (RegionFillUp, SelectedRegions, [‘rectangularity’,‘area’], ‘and’, [0.8,700], [1,99999])
  • 求取可旋轉最小外接矩形
    smallest_rectangle2 (SelectedRegions, Row, Column, Phi, Length1, Length2)
    gen_rectangle2 (Rectangle, Row, Column, Phi, Length1, Length2)
  • 求邊界,膨脹,減小定義域。以達到提取定義域效果。
    boundary (Rectangle, RegionBorder, ‘inner_filled’)
    dilation_rectangle1 (RegionBorder, RegionDilation, 4, 4)
    reduce_domain (Image, RegionDilation, ImageReduced)
    dev_clear_window ()
    dev_display (ImageReduced)
    disp_continue_message (WindowID, ‘black’, ‘true’)
    stop ()
  • 使用canny算子提取邊緣
    edges_sub_pix (ImageReduced, Edges, ‘canny’, 1.5, 30, 40)
  • 分割XLD輪廓,算子解釋傳送門
    segment_contours_xld (Edges, ContoursSplit, ‘lines’, 5, 2, 2)
  • 通過長度篩選邊緣
    select_contours_xld (ContoursSplit, SelectedContours1, ‘contour_length’, 10, 99999, -0.5, 0.5)
  • 合并臨近的XLD輪廓
    union_adjacent_contours_xld (SelectedContours1, UnionContours1, 30, 1, ‘attr_keep’)
  • 擬合最小外接矩形
    fit_rectangle2_contour_xld (UnionContours1, ‘tukey’, -1, 0, 0, 3, 2, Row1, Column1, Phi1, Length11, Length12, PointOrder1)
  • 繪制XLD最小外接矩形
    gen_rectangle2_contour_xld (Rectangle1, Row1, Column1, Phi1, Length11, Length12)
  • 下邊一段代碼與上邊一樣哈
    fast_threshold (Image, Region1, 65, 255, 20)
    connection (Region1, ConnectedRegions1)
    opening_rectangle1 (ConnectedRegions1, RegionOpening1, 10, 10)
    fill_up (RegionOpening1, RegionFillUp1)
    select_shape (RegionFillUp1, SelectedRegions1, ‘area’, ‘and’, 1000, 99999)
    boundary (SelectedRegions1, RegionBorder1, ‘inner’)
    dilation_rectangle1 (RegionBorder1, RegionDilation1, 10, 10)
    reduce_domain (Image, RegionDilation1, ImageReduced1)
    dev_clear_window ()
    dev_display (ImageReduced1)
    disp_continue_message (WindowID, ‘black’, ‘true’)
    stop ()
    threshold_sub_pix (ImageReduced1, Border1, 70)
    segment_contours_xld (Border1, ContoursSplit2, ‘lines’, 5, 2, 2)
    select_contours_xld (ContoursSplit2, SelectedContours2, ‘contour_length’, 30, 99999, -0.5, 0.5)
    union_adjacent_contours_xld (SelectedContours2, UnionContours2, 30, 1, ‘attr_keep’)
    fit_rectangle2_contour_xld (UnionContours2, ‘tukey’, -1, 0, 0, 3, 2, Row2, Column2, Phi2, Length21, Length22, PointOrder2)
    gen_rectangle2_contour_xld (Rectangle2, Row2, Column2, Phi2, Length21, Length22)
    dev_clear_window ()
    dev_set_colored (3)
  • dev_display (Image)
    dev_display (SelectedContours1)
    dev_display (SelectedContours2)
    disp_continue_message (WindowID, ‘black’, ‘true’)
    stop ()
    dev_set_color (‘white’)
    dev_display (UnionContours1)
    dev_set_color (‘yellow’)
    dev_display (UnionContours2)
    disp_continue_message (WindowID, ‘black’, ‘true’)
    stop ()
    dev_display (Image)
    dev_set_color (‘white’)
    dev_display (Rectangle1)
    gen_cross_contour_xld (Cross1, Row1, Column1, 6, Phi1)
    dev_display (Cross1)
    dev_set_color (‘yellow’)
    dev_display (Rectangle2)
    gen_cross_contour_xld (Cross2, Row2, Column2, 6, Phi2)
    dev_display (Cross2)
    distance_pp (Row1, Column1, Row2, Column2, Distance)
    DifferenceOrientation := Phi1 - Phi2
    set_tposition (WindowID, 10, 10)
    write_string (WindowID, ‘Distance between centers: ’ + Distance′.3′+′pixel′)settposition(WindowID,25,10)writestring(WindowID,′Differencebetweenorientations:′+deg(DifferenceOrientation)'.3' + ' pixel') set_tposition (WindowID, 25, 10) write_string (WindowID, 'Difference between orientations: ' + deg(DifferenceOrientation).3+pixel)sett?position(WindowID,25,10)writes?tring(WindowID,Differencebetweenorientations:+deg(DifferenceOrientation)’.2’ + ’ deg’)
    dev_update_window (‘on’)

處理思路

這個例子是主要講解了矩形邊緣的擬合。

后記

大家有什么問題可以向我提問哈,我看到了第一時間回復,希望在學習的路上多多結交良師益友。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/255066.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/255066.shtml
英文地址,請注明出處:http://en.pswp.cn/news/255066.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

工業機器人智能發展:視覺和觸覺感應簡化

機器人工業協會(Robotic Industries Association)指出,從2003到2005年間,北美機器人工業以20%的平均年增長率發展。在汽車市場需求疲軟以及外國廠商的壓力不斷增加的背景下,這一成就是如何取得的?成本的普遍…

ASP站點無法訪問怎么辦

確保啟用了目錄瀏覽功能 轉載于:https://www.cnblogs.com/acetaohai123/p/6571257.html

五、案例-指令參考-freemarker指令、表達式

案例-指令參考描述&#xff1a;本人自己測試寫了一遍&#xff0c;如有錯的地方&#xff0c;懂freemarker的朋友望指點指點&#xff01; 案例-指令參考 表達式 一、 Assign 1、<#assign name1"北京" name2"上海" name3"廣東"> 調用&#xf…

PartitionMotionSearch()函數

encode_one_macroblock()函數中的運動估計分為兩大塊&#xff0c;對于宏塊級的三種模式&#xff0c;分塊后直接對patition依次調用PartitionMotionSearch()函數&#xff1b;而對于亞宏塊級的&#xff08;含8x8, 8x4,4x8,4x4&#xff09;模式&#xff0c;首先將宏塊拆分為4個88子…

201521123017 《Java程序設計》第4周學習總結

1. 本周學習總結 2. 書面作業 Q1.注釋的應用 使用類的注釋與方法的注釋為前面編寫的類與方法進行注釋&#xff0c;并在Eclipse中查看。(截圖) Q2.面向對象設計(大作業1&#xff0c;非常重要) 2.1 將在網上商城購物或者在班級博客進行學習這一過程&#xff0c;描述成一個故事。…

完整的VAL3程序

start() begin//延時10秒 delay(5)//初始化變量call init()//清空原有運動堆棧resetMotion()//建立上電任務taskCreate "robotpower",100,robotpower()wait(isPowered())//建立生產任務taskCreate "ProductionCycle",10,ProductionCycle()//建立安全區域…

iOS WebView 加載本地資源(圖片,文件等)

NSString *path [[NSBundle mainBundle] pathForResource:"關于.docx" ofType:nil]; NSURL *url [NSURL fileURLWithPath:path]; NSLog("%", [self mimeType:url]); //webview加載本地文件&#xff0c;可以使用加載數據的方式 //第一個誒參數是一個N…

本文以H264視頻流為例,講解解碼流數據的步驟。

本文以H264視頻流為例&#xff0c;講解解碼流數據的步驟。 為突出重點&#xff0c;本文只專注于討論解碼視頻流數據&#xff0c;不涉及其它&#xff08;如開發環境的配置等&#xff09;。如果您需要這方面的信息&#xff0c;請和我聯系。 準備變量 定義AVCodecContext。如…

2008-2021年商業銀行數據(農商行、城商行、國有行、股份制銀行)

2008-2021年商業銀行數據&#xff08;農商行、城商行、國有行、股份制銀行&#xff09; 1、時間&#xff1a;2008-2021年 2、范圍&#xff1a;1700銀行 3 、指標&#xff1a;證券簡稱、year、證券代碼、資產總計、負債合計、所有者權益合計、利潤總額、凈利潤、貸款總額、存…

EPSON 任務同步 改寫

有時需要在多個任務執行之前來使它們同步。如果預先知道執行每項任務所需要的時間&#xff0c;它們就可以通過簡單地等待由最慢的任務產生的信號來實現同步。然而&#xff0c;如果不知道那個任務是最慢的&#xff0c;就需要使用一個更復雜的同步化機制&#xff0c;如下所示VAL …

線程池的簡單使用

創建指定線程數量的線程池 private static ExecutorService scheduledTaskFactoryExecutor null;private boolean isCancled false;private static class ThreadFactoryTest implements ThreadFactory { Overridepublic Thread newThread(Runnable r) { Thread threa…

異常--自定義異常類

為什么要調用父類構造器? http://blog.csdn.net/rockpk008/article/details/52951856 轉載于:https://www.cnblogs.com/dwj-ngu/p/6576382.html

利用ffmpeg來進行視頻解碼的完整示例代碼

&#xff08;轉&#xff09;利用ffmpeg來進行視頻解碼的完整示例代碼&#xff08;H.264&#xff09; Decode() { FILE * inpf; int nWrite; int i,p; int nalLen; unsigned char * Buf; int got_picture, consumed_bytes; unsigned char *DisplayBuf; Displ…

安卓觀看免費視頻

http://www.imooc.com/search/course?wordsAndroid%E6%94%BB%E5%9F%8E%E7%8B%AE%E7%AC%AC%E4%B8%80%E8%AF%BE&page3 http://www.imooc.com/course/list?candroid&src360onebox http://www.bilibili.com/video/av2788563/index_4.html http://www.imooc.com/course/pr…

EtherCAT 網站鏈接

http://www.ethercat.org.cn/cn.htm EtherCAT技術介紹 EtherCAT系統組成和工作原理 EtherCAT采用主從式結構&#xff0c;主站PC機采用標準的100Base-TX以太網卡&#xff0c;從站采用專用芯片。系統控制周期由主站發起&#xff0c;主站發出下行電報&#xff0c;電報的最大有效數…

IEC 6-1131/3的5種標準編程語言

用于開發控制系統和商業管理系統的TRACE MODE6編程工具面向不同領域的軟件工程師. TRACE MODE6包含的五種編程語言為&#xff1a;Techno SFC、Techno LD、Techno FBD、Techno ST和Techno IL. 這些語言是下列IEC 6-1131/3標準語言的擴展&#xff1a; SFC&#xff08;順序功能圖…

ngRx 官方示例分析 - 4.pages

Page 中通過構造函數注入 Store&#xff0c;基于 Store 進行數據操作。 注意 Component 使用了 changeDetection: ChangeDetectionStrategy.OnPush. OnPush means that the change detectors mode will be set to CheckOnce during hydration. /app/containers/collection-page…

用ffmpeg把yuv格式轉化為mpeg格式

http://blog.sina.com.cn/s/blog_5f5ad6a90100cs5k.html

方法:查詢MongoDB數據庫中最新一條數據(JAVA)

使用JAVA語言查詢MongoDB中某個數據庫某個集合的最新一條數據&#xff1a; MongoCollection<Document> cpu MongoClient.getDatabase("sysmgr").getCollection("cpu"); //獲取所需集合 Document dbo cpu.find().sort(descending("time"…

NoPause/NoEmgAbort的任務 與后臺任務的區別

NoPause/NoEmgAbort的任務示例 下面的例子顯示了一個程序&#xff0c;可以監視控制器的錯誤并根據錯誤編號在發生錯誤時切換I/O On/Off。 Function main Xqt ErrorMonitor, NoEmgAbort : FendFunction ErrorMonitor Wait ErrorOnIf 4000 < SysErr And Syserr < 5999 T…