栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

halcon--寻找图像中清晰度最高的图像

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

halcon--寻找图像中清晰度最高的图像

文件夹内有不同对焦情况下的图像,使用某种图像清晰度评定方法(intensity),遍历所有图片,找到在此评定方法下,清晰度最高的图像,将其显示在图像窗口上。

*读取文件夹
dev_clear_window ()
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
dev_set_draw ('margin')
list_image_files ('F:/CYYT/VirtualProject/focus', 'default', [], ImageFiles)
*遍历图片
Ret:=[]
for Index := 1 to |ImageFiles| - 1 by 1
    read_image (Image, ImageFiles[Index])
    rgb1_to_gray (Image, GrayImage)  
    get_image_size (GrayImage, Width, Height) 
    intensity (GrayImage, GrayImage, Mean, Deviation)
    set_tposition (WindowHandle, 300, 200)
    write_string (WindowHandle, 'The' +Index + 'th' +' image')
    *把方差保存到字典中
    Ret:=[Ret,Deviation]  
endfor
index1 := find(Ret,max(Ret))
*显示清晰度最高的图像
read_image (Image1, 'F:/CYYT/VirtualProject/focus/focus_bga_'+index1$'02d')
dev_display (Image1)
set_tposition (WindowHandle, 300, 200)
write_string (WindowHandle, 'This is the highest definition image')

运行结果

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/313900.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号