关于region Of interst-ROI

1.
This approach combines
region information with the image matrix: Only the image part corresponding to the region remains
relevant, which reduces the number of pixels to be processed.
 
Region用矩阵存储,仅存储Region区域的数据
 
2.
HALCON allows to make full use of the concept of ROIs because it enables using arbitrary
shapes for the regions. This means that you are not limited to standard shapes like rectangles or polygons,
but can really use any form - the best one to solve a given problem.
 
ROI 可以是任意形状
 
3.
3.1 Base Concept 基本概念
Making use of ROIs is split into two simple parts: creating regions and combining them with the image.
 
使用ROI分为两步
3.1.1  Create Region  -- 创建Region
 
The traditional way
is to generate standard shapes like circles, ellipses, rectangles, or polygons. In addition, regions can
be derived by converting them from other data types like XLD, by segmenting an image, or by user
interaction.
 
传统的方法:生成 形状 比如 圆 矩形 多边形,此外region 可以转换为其他数据类型 比如XLD
 
3.1.2  Create ROI
 
By combining a region with an image, the region assumes the role of an ROI。
In HALCON, the ROI is also called the domain of the image
An ROI reduces the domain of this function from the complete image to the relevant part.
Therefore, the operator to combine regions and images is called reduce_domain. This simple operator
fulfills the desired task in almost all applications.
 
region 和图像结合,承担起了ROI的角色。
在halcon中,ROI 称为图像的域。
region和图像结合的操作 叫做 reduce_domain,这个操作几乎所有应用中都有需要
 
3.1.3 一个简单的例子
 
read_image (Image, 'mreut')              
gen_circle (ROI, 256, 256, 200)            * 创建一个圆
reduce_domain (Image, ROI, ImageReduced)  *和图像结合起来--- 选取图像中的圆范围的图像 形成了ROI
edges_sub_pix (ImageReduced, Edges, 'lanser2', 0.5, 20, 40)
dev_display (Image)
dev_display (ROI)
dev_display (Edges)
 
 
3.2  Extended Conceptd  拓展概念
 
When we take a closer look at ROIs, extra steps become important if an application needs to be more
flexible.
 
当我们想仔细研究ROI时,如果应用想要更灵活就需要额外的步骤。
 
 
3.2.1  Segment Image 分割图像
 
3.2.2 Draw Region
 
The standard way to specify ROIs is to draw the shape interactively using the mouse. To make this easy,
HALCON provides special operators for standard shapes and free-form shapes. All operators for this
kind of action start with the prefix draw_. The drawing is performed by making use of the left mouse
button (drawing, picking, and dragging) and finished by clicking the right mouse button. For each such   
draw-operator HALCON provides operators to generate regions by using the returned parameters (see
the description of the step Create Region on page 19). Operators for mouse interaction can be found in
the reference manual in the chapter “Graphics . Drawing”. More information on user interaction can be
also found in the chapter Visualization on page 283。
      
该方法可以通过鼠标指定ROI。左键指定,右键完成。这种操作室 draw_  形式。
在 Graphics .-》Drawing 可以找到
 
 
3.2.3  Create Region
 
operators like gen_circle,gen_rectangle2, or gen_region_polygon_filled are used
 
3.2.4  Process Region
 
Sometimes the shape of a given ROI, either generated from the program or defined by the user, does
not fulfill the requirements. Here, HALCON provides many operators to modify the shape to adapt it
accordingly. Often used operators are, e.g., fill_up to fill holes inside the region, shape_trans to
apply a general transformation like the convex hull or the smallest rectangle, or morphological operators
like erosion_circle to make the region smaller or closing_circle to fill gaps. For more details,
please refer to the description of this step on page 33.
 
有时给出的ROI 形状不理想 可以通过一些操作处理经常用到的fill_up 填充region里面的小洞 
shape_trans 或者形态学处理erosion_circle 让region变小 closing_circle  关闭裂口
 
3.2.5 Align ROIs or Image
 
Sometimes the coordinates of an ROI depend on the position of another object in the image. If the object
moves, the ROI must be moved (aligned) accordingly. This is achieved by first locating the object using
template matching. Based on the determined position and the orientation, the coordinates of the ROIs
are then transformed.
How to perform alignment using shape-based matching is described in the Solution Guide II-B in sec-
tion 2.4.3.2 on page 42.
 
有时候 ROI坐标和图像里的对象有关,如果对象移动 那么ROI也相应移动。可以通过模板匹配解决。
 
3.2.6 Create ROI
 
reduced_domain   标准的方法 
rectangle1_domain  是gen_rectangle1 。 reduce_domain的结合体
For advanced applications
change_domain can be used as a slightly faster version than reduce_domain。
 
3.2.7 visualize Result 显示结果
 
Finally, you might want to display the ROIs or the reduced images. With the operator get_domain, the
region currently used by the image can be accessed and displayed (and processed) like any other region.
When displaying an image, e.g., with disp_image, only the defined pixels are displayed. Pixels in the
graphics window outside the domain of the image will not be modified.
For detailed information see the description of this method on page 283.
 
 
 
Region 与connection算子
在例子的代码中经常看到 region后用connection操作
什么时候用connection呢? ---- connection是把多个region连接记起来作为
所以,当提取出了我们感兴趣的多个东西,在进行下一步统一处理,如select_shape 等时 用connection 连接,
一个比较巧妙的方法是,在算子窗口 region 如果是以目录的形式出现 也就意味着多个,这时可以用connection操作连接起来。
例句:
dyn_threshold (Image, ImageMean, RegionDynThresh, 7, 'dark')
 
connection(RegionDynThresh,ConnctedDynRegion)
 
select_shape (ConnctedDynRegion, SelectedRegions, 'area', 'and', 10, 1000)
 
 
 
 
 
 





posted @ 2011-11-29 13:20  小马_xiaoLV2  阅读(2892)  评论(5编辑  收藏  举报