<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      halcom-極限坐標轉換

      * 檢測瓶口缺陷
      * 
      * 
      * tuning parameters
      SmoothX := 501
      ThresholdOffset := 25
      MinDefectSize := 50
      * 
      * initialization
      PolarResolution := 640
      RingSize := 70
      *獲取存放空區域的狀態
      get_system ('store_empty_region', StoreEmptyRegion)
      *設置存放空區域的狀態
      set_system ('store_empty_region', 'false')
      *讀取圖像
      read_image (Image, 'bottles/bottle_mouth_01')
      *關閉程序計數器,變量更新,圖形窗口更新
      dev_update_off ()
      *關閉窗口
      dev_close_window ()
      dev_close_window ()
      *按圖像大小創建一個新窗口
      dev_open_window_fit_image (Image, 0, 0, 640, 512, WindowHandle1)
      *設置字體信息
      set_display_font (WindowHandle1, 16, 'mono', 'true', 'false')
      *顯示圖像
      dev_display (Image)
      *設置區域填充方式
      dev_set_draw ('margin')
      *設置輸出對象線寬
      dev_set_line_width (3)
      *按圖像大小創建一個新窗口
      dev_open_window_fit_size (0, 648, RingSize, PolarResolution, 150, 512, WindowHandle)
      *設置區域填充方式
      dev_set_draw ('margin')
      *設置輸出對象線寬
      dev_set_line_width (3)
      *設置對象顯示顏色
      dev_set_color ('red')
      
      *激活WindowHandle1窗口
      dev_set_window(WindowHandle1)
      * Main loop
      * 
      * Detect defects in bottle necks
      for Index := 2 to 16 by 1
          *讀取一張圖像
          read_image (Image, 'bottles/bottle_mouth_'+Index$'.02')
          *顯示圖像
          dev_display (Image) 
          *自動閾值
          auto_threshold (Image, Regions, 2)
          *獲取區域一
          select_obj (Regions, DarkRegion, 1)
          *對區域一進行開運算
          opening_circle (DarkRegion, RegionOpening, 3.5)
          *對開運算區域進行閉運算
          closing_circle (RegionOpening, RegionClosing, 25.5)
          *填充閉運算后區域
          fill_up (RegionClosing, RegionFillUp)
          *獲取區域外邊界
          boundary (RegionFillUp, RegionBorder, 'outer')
          *對區域邊界進行膨脹運算
          dilation_circle (RegionBorder, RegionDilation, 3.5)
          *剪切區域里的圖像
          reduce_domain (Image, RegionDilation, ImageReduced)
          * 
          * 運用CANNY算法進行邊緣探測
          edges_sub_pix (ImageReduced, Edges, 'canny', 0.5, 20, 40)
          *對邊緣輪廓分割成直線和圓
          segment_contours_xld (Edges, ContoursSplit, 'lines_circles', 5, 4, 2)
          *將共圓上的輪廓連接起來
          union_cocircular_contours_xld (ContoursSplit, UnionContours, 0.9, 0.5, 0.5, 200, 50, 50, 'true', 1)
          *獲取輪廓的長度
          length_xld (UnionContours, Length)
          *對長度數值進行降序排列,并獲取數值最大的長度值
          select_obj (UnionContours, LongestContour, sort_index(Length)[|Length|-1]+1)
          *對最大的輪廓進行擬合圓操作
          fit_circle_contour_xld (LongestContour, 'ahuber', -1, 0, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder)
          * 
          * Part 2: Transform the ring-shaped bottle neck region to a rectangle
          *生成擬合圓
          gen_circle (Circle, Row, Column, Radius)
          *對擬合圓進行膨脹運算
          dilation_circle (Circle, RegionDilation, 5)
          *對擬合圓進行腐蝕運算
          erosion_circle (Circle, RegionErosion, RingSize-5)
          *求兩區域補集
          difference (RegionDilation, RegionErosion, RegionDifference)
          *獲取補集區域里的圖像
          reduce_domain (Image, RegionDifference, ImageReduced)
          *將圖像從笛卡爾直角坐標系轉換到極坐標系
          polar_trans_image (ImageReduced, ImagePolar, Row, Column, PolarResolution, Radius+5)
          * 
          * Part 3: Find defects with a dynamic threshold
          * Note the strong smoothing in x-direction in the transformed image.
          *剪切矩形區域里的圖像
          crop_part (ImagePolar, ImagePart, Radius-RingSize, 0, PolarResolution, RingSize)
          *將最大灰度值在0-255范圍拉伸
          scale_image_max (ImagePart, ImageScaleMax)
          *對灰度拉伸的圖像進行均值濾波
          mean_image (ImageScaleMax, ImageMean, SmoothX, 3)
          *局部閾值處理
          dyn_threshold (ImageScaleMax, ImageMean, Regions1, 50, 'not_equal')
          *連通處理
          connection (Regions1, Connection)
          *根據高度過濾區域
          select_shape (Connection, SelectedRegions, 'height', 'and', 9, 99999)
          * 用矩形結構元素進行閉運算
          closing_rectangle1 (SelectedRegions, RegionClosing1, 10, 20)
          *將區域連接起來
          union1 (RegionClosing1, RegionUnion)
          * 將區域從極坐標轉換到直角坐標系中
          polar_trans_region_inv (RegionUnion, XYTransRegion, Row, Column, 6.28319, 0, Radius-RingSize, Radius, 640, RingSize, 1280, 1024, 'nearest_neighbor')
          * 
          * Part 4: Display results
          * 激活窗口WindowHandle1
          dev_set_window (WindowHandle1)
          dev_display (Image)
          dev_set_color ('blue')
          dev_display (RegionDifference)
          dev_set_color ('red')
          dev_display (XYTransRegion)
          * display polar transformed inspected region with results
          * The image and resulting region are rotated by 90 degrees
          * only for visualization purposes! (I.e. to fit better on the screen)
          * The rotation is NOT necessary for the detection algorithm.
          *激活窗口WindowHandle
          dev_set_window (WindowHandle)
          *旋轉圖像
          rotate_image (ImagePart, ImageRotate, 90, 'constant')
          dev_display (ImageRotate)
          count_obj (RegionUnion, Number)
          if (Number>0)
              *缺陷區域沿對角線鏡像
              mirror_region (RegionUnion, RegionMirror, 'diagonal', PolarResolution)
              *對鏡像區域再次沿列方向鏡像
              mirror_region (RegionMirror, RegionMirror, 'row', PolarResolution)
              *顯示鏡像以后的區域
              dev_display (RegionMirror)
              disp_message (WindowHandle1, 'Not OK', 'window', -1, -1, 'red', 'false')
          else
              disp_message (WindowHandle1, 'OK', 'window', -1, -1, 'forest green', 'false')
          endif
          if (Index<16)
              disp_continue_message (WindowHandle1, 'black', 'true')
              stop ()
          endif
          
          dev_set_window (WindowHandle1)
          
      endfor
      * 恢復存儲空區域的狀態
      set_system ('store_empty_region', StoreEmptyRegion)

       

      posted @ 2025-03-03 21:53  hotzhml  閱讀(25)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 国内熟妇人妻色在线视频| 高潮毛片无遮挡高清视频播放| 色婷婷欧美在线播放内射| 亚洲欧美日韩综合在线丁香| 人人爽天天碰天天躁夜夜躁| 国模粉嫩小泬视频在线观看| 性视频一区| 国偷自产av一区二区三区| 自拍偷区亚洲综合第二区| 国产免费一区二区不卡| 福利成人午夜国产一区| 亚洲熟妇自偷自拍另类| 成年视频人免费网站动漫在线 | 99久久国产成人免费网站| 国产AV无码专区亚洲AV漫画 | 亚洲国产成人久久77| 精品国产av最大网站| 国产成人亚洲精品在线看| 久久婷婷综合色丁香五月| 国产超碰人人做人人爰| 欧美牲交videossexeso欧美 | 97久久精品人人做人人爽| 欧美va天堂在线电影| 中文字幕人妻中出制服诱惑| 国产中文字幕在线精品| 午夜在线观看成人av| 一个人看的www视频免费观看| 精品无码一区二区三区的天堂 | 在线aⅴ亚洲中文字幕| 日本高清一区免费中文视频| 无码一区中文字幕| 国产精品自在线拍国产手青青机版| 午夜爽爽爽男女污污污网站| 无码帝国www无码专区色综合| 亚洲国产女性内射第一区| 国产精品亚洲二区在线播放| 人妻丝袜AV中文系列先锋影音| 中文字幕人妻丝袜美腿乱| 精品中文人妻在线不卡| 少妇宾馆粉嫩10p| 日本黄漫动漫在线观看视频|