天天看點

reduce_domain算子和crop_domain算子

1、算子:crop_domain ( Image : ImagePart : : )

功能:如果一副大圖上,就一塊區域有值,其他區域均沒有值。通過調用該函數,能夠将有值的區域以最小外界正矩形的方式傳回,而剪掉那些沒有值的區域。

參數:Image是輸入的原始圖像

參數:ImagePart是輸出的最小外界正矩形的圖像

特殊說明:crop_domain能夠對圖像的尺寸進行剪裁,即新圖像ImagePart尺寸變小。

2、算子:reduce_domain ( Image, Region : ImageReduced : : )

功能:通過reduce_domain确實能獲得特定區域Region位置的圖像

參數:Image是輸入的圖像

參數:Region是輸入的區域

參數:ImageReduced是輸出的圖像,是Image中Region的那部分圖像

特殊說明:reduce_domain是縮小一個圖像的定義域,并不縮小圖像的實際尺寸,即新圖像ImageReduced尺寸大小并未發生變化

3、算子:dev_update_window( : : DisplayMode : )

功能:指定是否在活動圖形視窗中顯示由算子調用傳回的所有圖示對象(DisplayMode ='on' - 預設)或不顯示(DisplayMode ='off')。此選項對單步模式下的對象輸出沒有影響。 執行單個算子之後,圖示輸出對象始終顯示在活動圖形視窗中。如果隻在圖形視窗中顯示標明的對象,則應該将此選項設定為'off'。 在這種情況下,對象應該由dev_display顯示。

4、執行個體介紹

dev_close_window ()

read_image(Image, 'D:/Documents/Pictures/12.png')

get_image_size(Image, Width, Height)

dev_open_window(0, 0, Width, Height, 'black', WindowHandle)

dev_display (Image)

draw_region(Region,WindowHandle)

dev_close_window ()

reduce_domain(Image,Region,ImageReduced)

dev_open_window (0, 0, Width, Height, 'black', WindowHandle1)

dev_display (ImageReduced)

dev_update_window ('off')

//crop_domain算子傳回的圖像會自動顯示在視窗中,這樣就會使用之前的視窗,兩個變量圖像就會重合//一起,在此處為了避免這種現象,關閉自動将傳回圖像顯示在圖像視窗中

crop_domain (ImageReduced, ImagePart)

get_image_size (ImagePart, Width1, Height1)

dev_open_window (0, 0, Width1, Height1, 'black', WindowHandle2)

dev_display (ImagePart)

reduce_domain算子和crop_domain算子
c#