• Halcon difference与sub_image的区别


    1.difference算子检测region形状的差别,计算对象是两个region,不考虑region灰度值是否有差异;

    2.sub_image算子是灰度值相减,计算对象是两幅图像,主要检测图像区别,和形状没有多大关系;

    g' = (ga - gb) * Mult + Add

    dev_update_off ()
    dev_close_window ()
    read_image (blackImage, 'E:/myhalcon/black.bmp')
    read_image (grayImage, 'E:/myhalcon/gray.bmp')
    dev_open_window_fit_image (grayImage, 0, 0, -1, -1, WindowHandle)
    set_window_param (WindowHandle, 'background_color', 'white')
    dev_clear_window ()
    gen_rectangle1 (Rectangle, 100, 100, 300, 300)
    reduce_domain (blackImage, Rectangle, blackImageReduced)
    reduce_domain (grayImage, Rectangle, grayImageReduced)
    
    * 检查形状区别,不考虑区域灰度值
    difference (blackImageReduced, grayImageReduced, RegionDifference)
    * 灰度值相减,不考虑形状
    sub_image (blackImageReduced, grayImageReduced, ImageSub, 1, 200)
    
    gen_rectangle1 (Rectangle1, 200, 200, 400, 400)
    reduce_domain (blackImage, Rectangle1, blackImageReduced1)
    sub_image (blackImageReduced, blackImageReduced1, ImageSub, 1, 200)
    

      

  • 相关阅读:
    CF763C Timofey and Remoduling
    CF762E Radio Stations
    CF762D Maximum Path
    CF763B Timofey and Rectangles
    URAL1696 Salary for Robots
    uva10884 Persephone
    LA4273 Post Offices
    SCU3037 Painting the Balls
    poj3375 Network Connection
    Golang zip压缩文件读写操作
  • 原文地址:https://www.cnblogs.com/zhengzc/p/11430207.html
Copyright © 2020-2023  润新知