zoukankan      html  css  js  c++  java
  • Halcon 计算line_gauss算子参数

    calculate_lines_gauss_parameters (MaxLineWidth, [Contrast,0], Sigma, Low, High)
    输入最大线宽以及对比度计算Sigma,Low,High
    * Check control parameters
    if (|MaxLineWidth| != 1)
        throw ('Wrong number of values of control parameter: 1')
    endif
    if (not is_number(MaxLineWidth))
        throw ('Wrong type of control parameter: 1')
    endif
    if (MaxLineWidth <= 0)
        throw ('Wrong value of control parameter: 1')
    endif
    if (|Contrast| != 1 and |Contrast| != 2)
        throw ('Wrong number of values of control parameter: 2')
    endif
    if (min(is_number(Contrast)) == 0)
        throw ('Wrong type of control parameter: 2')
    endif
    * Set and check ContrastHigh
    ContrastHigh := Contrast[0]
    if (ContrastHigh < 0)
        throw ('Wrong value of control parameter: 2')
    endif
    * Set or derive ContrastLow
    if (|Contrast| == 2)
        ContrastLow := Contrast[1]
    else
        ContrastLow := ContrastHigh / 3.0
    endif
    * Check ContrastLow
    if (ContrastLow < 0)
        throw ('Wrong value of control parameter: 2')
    endif
    if (ContrastLow > ContrastHigh)
        throw ('Wrong value of control parameter: 2')
    endif
    * 
    * Calculate the parameters Sigma, Low, and High for lines_gauss
    if (MaxLineWidth < sqrt(3.0))* 注意LineWidthMax < sqrt(3.0)将导致Sigma < 0.5,这没有任何意义,因为相应的平滑滤波掩码的大小为1x1。    
        * 为了避免这种情况,LineWidthMax被限制为大于或等于sqrt(3.0)的值,而对比度值则适用于反映这样一个事实:
        * 在平滑图像中,比sqrt(3.0)像素更细的线具有更低的对比度(与宽为sqrt(3.0)像素的线相比)。
        ContrastLow := ContrastLow * MaxLineWidth / sqrt(3.0)
        ContrastHigh := ContrastHigh * MaxLineWidth / sqrt(3.0)
        MaxLineWidth := sqrt(3.0)
    endif
    * 将LineWidthMax和给定的对比值转换为lines_gauss所需的输入参数Sigma, Low和High
    HalfWidth := MaxLineWidth / 2.0
    Sigma := HalfWidth / sqrt(3.0)
    Help := -2.0 * HalfWidth / (sqrt(6.283185307178) * pow(Sigma,3.0)) * exp(-0.5 * pow(HalfWidth / Sigma,2.0))
    High := fabs(ContrastHigh * Help)
    Low := fabs(ContrastLow * Help)
    return ()
  • 相关阅读:
    JProfiler9安装 监控Tomcat
    linux 大量的TIME_WAIT解决办法(转)
    C2 CompilerThread0 如果抓到的java线程dump里占用CPU最高的线程是这个,99%可能是因为服务重启了
    什么是多线程,锁,死锁,怎么避免死锁(转)
    Jmeter BeanShell 引用变量报错jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Parse error at line 14, column 181 : Error or number too big for integer
    小缘的游戏
    Bad Hair Day
    779A Pupils Redistribution
    Stripies
    校赛-种树
  • 原文地址:https://www.cnblogs.com/zhengzc/p/12871194.html
Copyright © 2011-2022 走看看