基本操作之——Object差异
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')
------------------------------------
承接
**视觉检测软件开发及调试
**工业软件开发
**上位机软件开发
wechat:luoran2024
qq:565934058
email:taoyuansu@qq.com
海量教育资源及影视资源下载
微信公众号:EFun科技
------------------------------------
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!