關於region Of interst-ROI

http://www.cnblogs.com/xiaomaLV2/archive/2011/11/29/2267493.html

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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值