首页 > 其他分享 >1D-Measuring

1D-Measuring

时间:2024-03-01 10:23:24浏览次数:30  
标签:Measuring rad Angle Length2 dev 1D measure 90

1.核心算子

measure_pos — Extract straight edges perpendicular to a rectangle or annular arc.   提取垂直于矩形或环形圆弧的直边

measure_pairs — Extract straight edge pairs perpendicular to a rectangle or annular arc  提取垂直于矩形或环形圆弧的直边对;将返回具有明-暗-亮过渡的边缘对或具有深-明-暗过渡的边缘对

measure_pairs的提取算法与measure_pos相同

2.测试

measure_pairs (Fuse, MeasureHandle, 1, 10, 'positive', 'first', RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance)

对应效果:

measure_pairs (Fuse, MeasureHandle, 1, 10, 'negative', 'first', RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance)

对应效果如下:

 

measure_pairs (Fuse, MeasureHandle, 1, 10, 'negative', 'first', RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance)

对应效果如下:

 

 

dev_update_window ('off')
dev_close_window ()
* ****
* step: acquire image
* ****
read_image (Image, 'test.bmp')
get_image_size (Image, Width, Height)
dev_open_window_fit_image (Image, 0, 0, Width, Height, WindowID)
set_display_font (WindowID, 12, 'mono', 'true', 'false')
dev_set_draw ('margin')
dev_set_line_width (3)
dev_display (Image)
set_display_font (WindowID, 12, 'mono', 'true', 'false')
disp_continue_message (WindowID, 'black', 'true')
stop ()
* ****
* step: create measure object
* ****
* -> specify ROI
dev_get_window(WindowHandle)
draw_rectangle2(WindowHandle, Row, Column, Angle, Length1, Length2)
gen_rectangle2 (ROI, Row, Column, Angle, Length1, Length2)
* -> create measure object
gen_measure_rectangle2 (Row, Column, Angle, Length1, Length2, Width, Height, 'bilinear', MeasureHandle)
dev_display (ROI)
disp_continue_message (WindowID, 'black', 'true')
stop ()
* ****
* step: measure
* ****
dev_display (Image)
dev_display (ROI)
set_display_font(WindowHandle, 36, 'mono', 'true', 'false')
measure_pairs (Image, MeasureHandle, 1, 10, 'negative', 'first', RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance)
disp_continue_message (WindowID, 'black', 'true')
stop ()
* ****
* step: visualize results
* ****
for i := 0 to |RowEdgeFirst| - 1 by 1    
    *创建查找到第一条边缘
*     gen_contour_polygon_xld (EdgeFirst, [-sin(Angle + rad(90)) * Length2 + RowEdgeFirst[i],-sin(Angle - rad(90)) * Length2 + RowEdgeFirst[i]], [cos(Angle + rad(90)) * Length2 + ColumnEdgeFirst[i],cos(Angle - rad(90)) * Length2 + ColumnEdgeFirst[i]])
    *创建查找到第二条边缘
*     gen_contour_polygon_xld (EdgeSecond, [-sin(Angle + rad(90)) * Length2 + RowEdgeSecond[i],-sin(Angle - rad(90)) * Length2 + RowEdgeSecond[i]], [cos(Angle + rad(90)) * Length2 + ColumnEdgeSecond[i],cos(Angle - rad(90)) * Length2 + ColumnEdgeSecond[i]])
    
    
    gen_contour_polygon_xld (EdgeFirst, [-sin(Angle + rad(90)) * Length2 + RowEdgeFirst[i],-sin(Angle - rad(90)) * Length2 + RowEdgeFirst[i]], [cos(Angle + rad(90)) * Length2 + ColumnEdgeFirst[i],cos(Angle - rad(90)) * Length2 + ColumnEdgeFirst[i]])
    *创建查找到第二条边缘
    gen_contour_polygon_xld (EdgeSecond, [-sin(Angle + rad(90)) * Length2 + RowEdgeSecond[i],-sin(Angle - rad(90)) * Length2 + RowEdgeSecond[i]], [cos(Angle + rad(90)) * Length2 + ColumnEdgeSecond[i],cos(Angle - rad(90)) * Length2 + ColumnEdgeSecond[i]])
   
    dev_set_color ('cyan')
    dev_display (EdgeFirst)
    dev_set_color ('magenta')
    dev_display (EdgeSecond)
    dev_set_color ('blue')
    if (i == 0)
        set_tposition (WindowID, RowEdgeFirst[i] + 5, ColumnEdgeFirst[i] + 20)
    else
        set_tposition (WindowID, RowEdgeFirst[i] - 40, ColumnEdgeFirst[i] + 20)
    endif
    write_string (WindowID, 'width: ' + IntraDistance[i] + ' pix')
endfor
disp_continue_message (WindowID, 'black', 'true')
stop ()
* ****
* step: destroy measure object
* ****
close_measure (MeasureHandle)
* dev_update_window ('on')
* dev_clear_window ()

 

标签:Measuring,rad,Angle,Length2,dev,1D,measure,90
From: https://www.cnblogs.com/echo-efun/p/18046149

相关文章

  • CF351D - Jeff and Removing Periods 题解
    首先做一点显然的转化:在进行第一次操作之后,可以将相同的数排在一起,这样一次就能删掉一种数。如果一开始就能删光一种数的话,那么次数就是区间颜色数,否则就是区间颜色数\(+1\)。所以现在原问题变成了两个问题:求区间内不同颜色数,判断区间内是否有某种颜色满足其出现位置构成等差数......
  • CF111D Petya and Coloring 题解
    很明显这是一道组合题。首先特判一下,当\(m=1\)时,答案就是\(k^n\)。对于\(m>1\)的情况,我们可以得出一个结论:对于沿格子的线穿过的任何垂直线,会将棋盘分成两个非空的部分,这两个部分中的不同颜色的数量相同且总是不变。设这个不同颜色的数量为\(i\),那么左边这部分的颜色一定......
  • ABC341D
    ABC341D赛事思路:按lcm分周期处理不可行的理由:a,b在同一个周期里排列无规律lcm可能很大(周期内最多能有2e5左右个数),不好预处理正解二分(二分结果的值)答案序列内数的排名单增排名容易Checkmid/n+mid/m-(mid/lcm)*2#include<iostream......
  • P3038 [USACO11DEC] Grass Planting G - 重链剖分
    本题可以说是板题P3384的弱化版,只不过要改的变成了边权边权很好处理,只需要将每个边的边权下放到两端点深度比较深的上面就好了(因为每个点连比它浅的节点必定只有一条边)。那么就将模板改一下就好了代码如下:#include<cstdio>usingnamespacestd;constintN=1e5+5;in......
  • 题解 ARC171D【Rolling Hash】
    来补题了。昨天赛时想法是对的,代码写错了,没调过太可惜了。显然\(P>n\)时必定有解。设前缀\([1,i]\)的哈希值为\(s_i\),显然\([l,r]\)的哈希值不为\(0\)的充要条件是\(s_{l-1}\nes_r\)。建立一个点的编号为\(0\simn\)的图,对于每个输入的区间\([l,r]\),连接一条边......
  • OneFlow框架0.9.1dev版本,成功安装并运行
    安装cuda和cudnn:condainstallcudatoolkit==11.8.0python3-mpipinstallnvidia-cudnn-cu11==8.7.0.84下载安装包的下载地址页面:wgethttps://oneflow-staging.oss-cn-beijing.aliyuncs.com/branch/master/cu118并从中找到对应python版本的安装包地址。下载框架安装......
  • CF351D Jeff and Removing Periods
    https://www.luogu.com.cn/problem/CF351D由于每次操作后存在重排操作,我们可以让序列(询问的区间)中的相同值放在一块,这样以后每次操作就能删掉一整个值相同的位置了。那么第二次操作后所需操作数就是当前序列中不同数的个数。经典数颜色问题,离线线段树/莫队/主席树都能做。数颜色......
  • 题解 [ABC321D] Set Menu
    【洛谷博客】题意给定一个长度为\(N\)的正整数数列\(A\),和一个长度为\(M\)的正整数数列\(B\),还有一个正整数\(P\)。你需要求:\[\sum\limits^{N}_{i=1}\sum\limits^{M}_{j=1}\min(A_i+B_j,P)\]分析说实话感觉这题比C还要简单。先考虑单个\(A_i\)能产生的贡献,可以......
  • abc101d<打表,数学>
    题目D-SnukeNumbers思路打表找规律:voidbf(intn){vector<int>ans;doubleminn=double(n)/get(n);for(inti=n-1;i>=1;i--){doublet=double(i)/get(i);if(t<=minn+1e-9){m......
  • ARC151D Binary Representations and Queries
    ARC151DBinaryRepresentationsandQueries题目链接:ARC151DBinaryRepresentationsandQueries非常好思维题。思路首先我们会发现每个操作都是\(\frac{n}{2}\)的\(A_i\),给另外\(\frac{n}{2}\)的\(A_j\)的增加。这题直接去维护每个操作时间复杂度会开心的笑。所以......