精华内容
参与话题
问答
  • lines

    2017-08-18 04:57:51
    John has several lines. The lines are covered on the X axis. Let A is a point which is covered by the most lines. John wants to know how many lines cover A. Input The first line contains a single ...
  • Lines

    2017-09-28 11:44:39
    He draws several lines on the paper with n×m square grids (see the left figure). After that, he writes down the number of lines passing through every integer coordinate in a matrix (see the right ...
  • lines

    2013-03-05 20:15:22
  • <p>For outline layers, pcb2gcode can treat the drawn lines as 1D lines and not 2D shapes, and then join the lines together to make shapes. This is the default because the edge cuts layer is usually ...
  • While I believe there are merits for choosing to use lines in file as lines in code, I believe a more accurate measure of the lines of code are all lines in the file that are not blank, docstrings, ...
  • 提取线条的lines_color、lines_facet、 lines_gauss算子 Halcon中线条提取的算子主要有: lines_color(Image : Lines : Sigma, Low, High, ExtractWidth, CompleteJunctions : ) lines_facet(Image : Lines :...

    提取线条的lines_color、lines_facet、 lines_gauss算子

     

    Halcon中线条提取的算子主要有:

     

    lines_color(Image : Lines : Sigma, Low, High, ExtractWidth, CompleteJunctions : )

    lines_facet(Image : Lines : MaskSize, Low, High, LightDark : )

    lines_gauss(Image : Lines : Sigma, Low, High, LightDark, ExtractWidth, LineModel, CompleteJunctions : )

     

    其中lines_facet、 lines_gauss又可以归为同一类(从帮助文档的算子签名Signature可知这一点)。

     

     

    一、线条提取和边缘提取的区别

     

    上面三个线条提取的算子,输出的是一堆XLD;而 edges_sub_pix 这种边缘提取算子,得到的也是一堆XLD。那么它们有什么区别呢?

    举个例子说明:

    read_image (Image, 'angio-part')
    count_channels (Image, Channels)
    if (Channels == 3 or Channels == 4)
        rgb1_to_gray (Image, Image)
    endif
    
    lines_gauss (Image, Lines, 2.3, 0.0, 0.7, 'dark', 'true', 'parabolic', 'true')
    edges_sub_pix (Image, Edges, 'canny', 1, 5, 10)
    dev_set_color ('green')
    dev_display (Image)
    dev_display (Lines)

     

    lines_gauss和edges_sub_pix 输出的XLD的区别对比如下:

     

    相信大家已经看出了两者的区别了。

     

    图像的“边缘”指的是:图像中灰度有明显跳变的地方。如果在图中画一条“有一定宽度的线”,那么线的两侧应该都可以提取到边缘。

    而线条提取的算子(例如lines_gauss)提取的是这条“有一定宽度的线”的“骨架线”,它一般只有一根。

     

    为什么我想写一篇文章单独讲“线条提取”呢?主要因为跟我目前工作遇到的困难有关。

    公司目前在用传统算法 + 深度学习做复杂缺陷检测。如果用Halcon做缺陷检测的话,用到的无非是形态学分析、频域处理、特征筛选等等,但是对于不太明显或者难以定位分割的缺陷,Halcon就束手无策了。但是深度学习在这方面有独特的优势,它可以通过标注大量的缺陷形态,不断训练学习,从而获得对复杂缺陷的识别定位能力。

     

    但是对于“较浅且大批量出现的划痕”这种缺陷类型,深度学习也束手无策,因为它很难去逐个标注这些缺陷——一方面标注工作量太大,一方面很难准确地标注

     

    划痕,其实就是一种线条,用Halcon提供的线条提取算子,可以很轻松找出这些划痕(或线条)。

     

     

    二、lines_color

     

    算子描述为:检测有色的线条及其宽度。

    lines_color(Image : Lines : Sigma, Low, High, ExtractWidth, CompleteJunctions : )

     

    该算子从输入图像Image中提取彩色线条,并将提取的线条以亚像素XLD轮廓的形式返回Lines。

     

     

    Sigma——要应用的高斯平滑量。

    Low——磁滞阈值操作的下限阈值。

    High——磁滞阈值操作的上限阈值。

    ExtractWidth——应该提取线宽吗?(一般选择‘true’)

    CompleteJunctions——是否应该在无法提取的地方添加连接点?

     

     

    注意:

    如果使用较大的平滑量(Sigma),应相应地为“High”和“Low”选择较小的值。

    一般来说,特别是在需要提取线条宽度的时候,参数Sigma的选择应该满足Sigma >= w/1.732(w代表图像中线条的宽度(线条直径的一半)),最小允许值是Sigma >= w/2.5。例如,对于一个宽度为4个像素(直径为8个像素)的线条来说,Sigma >= 2.3是合适的参数。(4/1.732 = 2.3)

     

    下面研究一下CompleteJunctions参数的意思。它可取的值有true或者false。该参数的意思为:是否应该在无法提取的地方添加连接点?

    那它到底有什么作用呢?举例说明:

    read_image (Image, 'cable1')
    lines_color (Image, Lines1, 3.5, 0, 12, 'true', 'false')
    lines_color (Image, Lines2, 3.5, 0, 12, 'true', 'true')
    
    dev_set_color ('green')
    dev_clear_window ()
    dev_display (Lines1)
    dev_clear_window ()
    dev_display (Lines2)

     

    意思很明显了,当CompleteJunctions = 'true'时,会在无法提取的地方添加连接点,这样某些XLD可能会连起来。参考官方示例程序:lines_color.hdev。

     

     

    三、lines_facet

     

    算子描述为:使用小平面模型检测线条。

    lines_facet(Image : Lines : MaskSize, Low, High, LightDark : )

     

    下面的观点提炼自帮助文档:

    ① 参数LightDark确定是提取亮线还是暗线。

    ② MaskSize的值越大,图像的平滑度就越大,但可能会导致线条的局部化程度更差;MaskSize的值越小,提取的线条越短,碎片越多,但这可能会导致相当长的执行时间。

    ③ 关于取值,当Sigma=1.5时,此时大致对应于MaskSize 的值为5。

     

    但是,这个算子我们一般不用。因为如何给MaskSize、Low、High取合适的值确实是一门技术活,不好掌握,更重要的lines_gauss算子完全可以替代它,并且更易掌握。OK,忘记lines_facet吧。

     

     

    四、lines_gauss

     

    算子描述为:检测线及其宽度。

    lines_gauss(Image : Lines : Sigma, Low, High, LightDark, ExtractWidth, LineModel, CompleteJunctions : )

     

    这里多了一个参数LineModel(其他参数前面都说过)。

     

    LineModel:提取线条的模式,有'none',  'bar-shaped',  'parabolic',  'gaussian' 四种。含义如下:

     

    对大多数应用来说,LineModel的'bar-shaped'参数是正确的选择,'parabolic'参数常用来提取边缘比较锐利的线条(比如背光照明的图像中的线条),'gaussian'则在线条边缘不那么锐利的时候使用。参数LineModel仅在参数ExtractWidth被设置为'true'时才有意义。

     

    上图中,可以看出'parabolic'图示中,箭头指向的过渡处过渡陡峭(适合提取锐利的线条)。而'gaussian'图示中,箭头指向的过渡处过渡平滑(适合提取边缘平滑的线条)。

     

    其实lines_gauss算子的参数是最多的,因此参数如何正确取值一点都不简单。但是很明显,官方偏爱lines_gauss这个算子,它们开发了calculate_lines_gauss_parameters算子。

     

    calculate_lines_gauss_parameters( : : MaxLineWidth, Contrast : Sigma, Low, High)

    算子描述为:根据要提取的线条的最大宽度和对比度计算lines_gauss的参数Sigma、Low和High。

     

    MaxLineWidth定义要使用lines_gauss提取的线条的最大宽度。

    Contrast参数应设置为要提取的典型线条的灰度值对比度。在任何情况下都将提取具有较高对比度的所有线条。

    Contrast参数可以设为具有两个值的元组(例如[60, 10]),第二个值定义为要提取的线的最小对比度。

    第二个值不能大于第一个值。如果只给出一个值,则最小对比度默认为对比度/3.0。

    最小对比度的值越小,线条越长,线条延伸到对比度低的区域;值越高,线条越短,但线条越突出。

     

    还是以前面的图为例:

     

    read_image (Image, 'angio-part')
    count_channels (Image, Channels)
    if (Channels == 3 or Channels == 4)
        rgb1_to_gray (Image, Image)
    endif
    
    calculate_lines_gauss_parameters (8, [10,4], Sigma, Low, High)
    lines_gauss (Image, Lines, Sigma, Low, High, 'dark', 'true', 'parabolic', 'true')
    
    dev_set_color ('green')
    dev_display (Image)
    dev_display (Lines)

     

    由前文可知,对于线条提取,我们只需要掌握lines_colorlines_gauss这两个算子即可。

    展开全文
  • Add lines function

    2020-11-27 21:19:39
    public static String[] lines(String input) </code></pre> <p>Implementation should pass following test cases: <pre><code>java assertEquals(lines("Hello\nWorld").length, 2); assertEquals(lines...
  • <div><p>In a .js file, empty lines won't be filled with spaces/tabs of previous line when "fill-empty-lines" is set. Besides, FD (Scintilla maybe?) won't draw guide lines (those dotted...
  • 500 Lines or Less

    2018-05-10 19:55:38
    500 Lines or Less,python开源项目大集合,适合python进阶 500 Lines or Less,python开源项目大集合,适合python进阶
  • <div><p>Handles ACLs with independently unmatchable lines in <code>answerAclReachability</code>. Process: - Get unreachable lines - Find any independently unmatchable lines among those unreachable ...
  • datalines与datalines4语句详解

    千次阅读 2017-09-19 22:57:34
    datalines与datalines4语句详解 datalines语句 cards或datalineslines 一样的,标志数据块的开始,单独占一行。 该语句必须是数据步的最后一条语句。 例如: data mydb.student; input id name $ sex $ ...
    datalines与datalines4语句详解

    datalines语句
    cards或datalines或lines 一样的,标志数据块的开始,单独占一行。
    该语句必须是数据步的最后一条语句。

    例如:
    data mydb.student;
    input id name $ sex $ score;
    cards;
    101 张三 男 98
    102 李四 男 87
    103 兰兰 女 95
    ;
    run;

    datalines4语句
    如果数据行本身包含分号,可以使用 datalines4语句来完成。也可以使用该语句的别名为cards4或lines4。
    datalines4语句必须使用4个连续的分号开始的一行来标记数据行结束。

    例如:
    data a;
    input id name $;
    cards4; 
    *lines4;
    *datalines4
    1 a;b
    2 c;d
    ;;;;
    run;
    proc print;

    run;


    展开全文
  • bestcoder lines

    2014-12-09 21:08:43
    Problem Description ...John has several lines. The lines are covered on the X axis. Let A is a point which is covered by the most lines. John wants to know how many lines cover A.   Input T
    Problem Description
    John has several lines. The lines are covered on the X axis. Let A is a point which is covered by the most lines. John wants to know how many lines cover A.
     
    Input
    The first line contains a single integer T(1T100)(the data for N>100 less than 11 cases),indicating the number of test cases.
    Each test case begins with an integer N(1N105),indicating the number of lines.
    Next N lines contains two integers Xi and Yi(1XiYi109),describing a line.
     
    Output
    For each case, output an integer means how many lines cover A.
     
    Sample Input
    2 5 1 2 2 2 2 4 3 4 5 1000 5 1 1 2 2 3 3 4 4 5 5
     
    Sample Output
    3

    1

    #include <cstdio>
    #include <cstring>
    #include <string>
    #include <iostream>
    #include <stack>
    #include <queue>
    #include <stdlib.h>
    #include <algorithm>
    using namespace std;
    
    const double EPS=1e-8;
    const int MAXN=1000000+5;
    int a[MAXN*2], b[MAXN*2];
    
    struct node
    {
    	int star, en;
    } len[MAXN];
    
    
    int bs(int a[], int l, int r, int x)
    {
    	int mid = (l+r) / 2;
    
    	while(a[mid] != x)
    	{
    		if(a[mid] > x) {
    			r = mid;
    		}
    		else if(a[mid] < x) {
    			l = mid;
    		}
    
    		mid = (l+r)/2;
    	}
    
    	return mid;
    }
    int main()
    {
    	int cases, n, i;
    
    	scanf("%d", &cases);
    
    	while(cases--)
    	{
    		int cnt = 0, maxx = 0;
    
    		memset(a, 0, sizeof(a));
    		memset(b, 0, sizeof(b));
    
    		scanf("%d", &n);
    		
    		for(i = 0; i < n; i++)
    		{
    			scanf("%d %d", &len[i].star, &len[i].en);
    		
    			a[cnt++] = len[i].star;
    			a[cnt++] = len[i].en;
    		}
    
    		sort(a, a+cnt);
    		int p = 1;
    
    		for(i = 1; i < cnt; i++)
    		{
    			if(a[i] != a[i-1])
    				a[p++] = a[i];
    		}
    
    		cnt = p;
    
    		for(i = 0; i < n; i++)
    		{
    			int mid = bs(a, 0, cnt, len[i].star);
    
    			b[mid] += 1;
    
    			mid = bs(a, 0, cnt, len[i].en);
    
    			b[mid+1] += -1;
    		}
    
    		int ans = b[0];
    
    		for(i = 1; i < cnt; i++)
    		{
    			b[i] = b[i-1]+b[i];
    
    			if(b[i] > ans)
    				ans = b[i];
    		}
    
    		printf("%d\n", ans);
    	}
    	return 0;
    }
    



    展开全文
  • <div><p>Addresses issue #2448 where xray_lines argument type was not checked. <h2>Description of the change <ul><li>Change to get_lines_intensity() Check type of xray_lines arguement and raise a ...
  • Intersecting Lines

    2018-04-07 11:18:27
    Intersecting LinesTime Limit: 1000m Case Time Limit: 30000ms Memory Limit: 10000KB64-bit integer IO format: lld Java class name: MainWe...
  • vim onelines to two lines

    千次阅读 2017-02-16 09:59:53
    one line to two lines%s:\v(.).*:&^M& ctrl+v+ enter button= ^M
  • halcon中lines_color,lines_gauss

    千次阅读 2018-08-21 11:56:27
    lines_color,lines_gauss lines_color:提取有颜色的线的轮廓及宽度; lines_gauss:提取较弯曲或灰度的线的轮廓及宽度。 为了显示轮廓及线宽,通常要用: get_contour_attrib_xld (Line, ‘width_right’, ...
  • HDUOJ lines

    2014-12-03 22:33:03
    lines Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 590 Accepted Submission(s): 277 Problem Description John has several lines. T
  • Crisp grid and axis lines

    2020-12-08 18:37:24
    <p>It looks like the grid lines and axis lines are being antialiased causing 1px lines to be at least 2px. This makes the lines look ever so slightly fuzzy: ...
  • Fix the Lines

    2017-09-10 06:20:39
    Given several lines on a plane, let's calculate the minimum number of points needed to fix these lines on the plane. Input One integer 't' stating the number of test cases, followed by 't' blocks. ...
  • 最近项目中用到kettle,一直在研究kettle日志方面,今天遇到的问题是kettle执行转换后输出日志到数据库,LINES_READ,LINES_WRITTEN,LINES_UPDATE等字段为0,网上查了很多资料说是需要设置步骤,搜了半天也没有搜到,...
  • Fourier's Lines

    2017-10-09 08:13:22
    In one letter written to Bonard, Fourier asked a question: how to draw 17 lines on a plane to make exactly 101 crossings, where each crossing belongs to exactly two lines. Obviously, this is an easy ...
  • Bold ASCII Lines

    2017-12-05 08:08:07
    You come up with a solution: writing a program which duplicates the ASCII lines in order to make them look bold. Input The first line of the input will contain n, the number of test cases. For ...
  • Game of Lines

    2016-12-30 14:48:27
    Description ...* Line 1: A single integer representing the maximal number of lines Bessie can draw, no two of which are parallel.   Sample Input 4 -1 1 -2 0 0 0 1 1 Sample Output 4

空空如也

1 2 3 4 5 ... 20
收藏数 122,490
精华内容 48,996
关键字:

lines