obj_diff — Calculate the difference of two object tuples. 计算两个对象的差异
*region类型 获取内容差异
*image类型/XLDs类型 仅比较内存地址差异
*mixed类型(如image和xld的混合类型)
*
* obj_diff使用
read_image (Image, 'particle')
threshold (Image, Region, 57, 255)
connection (Region, ConnectedRegions)
*
* 初始化图像显示窗口
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window_fit_image (Image, 0, 0, Width, Height, WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_set_draw ('fill')
dev_set_colored (6)
*
* obj_diff calculates the difference of two object tuples,
* e.g., to extract those objects from an input tuple
* that have not yet been processed.
*obj_diff计算两个对象元组的差值,例如,从输入元组中提取尚未处理的对象。
select_shape (ConnectedRegions, LeftRegions, 'column', 'and', 0.0, 256.0)
obj_diff (ConnectedRegions, LeftRegions, RightRegions)
dev_clear_window ()
dev_display (RightRegions)
disp_message (WindowHandle, 'Difference of all regions and\nleft hand side regions:\nRight hand side regions', 'window', 12, 12, 'cyan', 'false')
disp_continue_message (WindowHandle, 'cyan', 'false')
stop ()
*
* An object tuple minus an empty object stays unaltered.
* 对象元组减去空对象保持不变
gen_empty_obj (EmptyObject)
obj_diff (ConnectedRegions, EmptyObject, ObjectsDiff)
dev_clear_window ()
dev_display (ObjectsDiff)
disp_message (WindowHandle, 'Difference of all regions and\nan empty object:\nAll regions', 'window', 12, 12, 'cyan', 'false')
disp_continue_message (WindowHandle, 'cyan', 'false')
stop ()
*
* An empty object minus any object returns an empty object.
*空对象减任何对象均为空对象
obj_diff (EmptyObject, LeftRegions, ObjectsDiff)
dev_clear_window ()
dev_display (ObjectsDiff)
disp_message (WindowHandle, 'Difference of an empty object\nand any other object:\nAn empty object', 'window', 12, 12, 'cyan', 'false')
disp_continue_message (WindowHandle, 'cyan', 'false')
stop ()
*
* Note that images are only compared by their position in
* the memory but not by their actual contents! Therefore,
* the following images are considered as being different
* and, as a consequence, the result is not empty.
* The same applies to XLDs.
*请注意,图像仅根据它们在内存中的位置进行比较,而不是按其实际内容进行比较!因此,以下图像被视为不同,因此,结果不为空。
* 这同样适用于XLD。
read_image (SameImage, 'particle')
obj_diff (Image, SameImage, ObjectsDiff)
dev_clear_window ()
dev_display (ObjectsDiff)
disp_message (WindowHandle, 'Difference of an image and\nthe same image reloaded:\nThe original image', 'window', 12, 12, 'cyan', 'false')
disp_continue_message (WindowHandle, 'cyan', 'false')
stop ()
*
* obj_diff also works for object tuples of mixed type.
*混合类型比较(图像及XLD构成混合类型对象)
gen_contour_polygon_xld (Contour, [50,150,250,250,250], [50,50,50,150,250])
concat_obj (Region, Contour, RegionAndXLD)
concat_obj (Region, Image, ImageAndRegion)
obj_diff (RegionAndXLD, ImageAndRegion, ObjectsDiff)
dev_clear_window ()
dev_display (ObjectsDiff)
disp_message (WindowHandle, 'Difference of mixed type objects', 'window', 12, 12, 'cyan', 'false')
标签:object,obj,差异,Object,dev,window,diff,基本操作,WindowHandle From: https://www.cnblogs.com/echo-efun/p/18058199