delphi7 网站开发,东莞手机端网络推广,做网站教程第一课,wordpress如何修改网站域名1.1 应用示例思路 
(1) 对核酸管图像进行灰度化、阈值分割和连通域分析#xff1b; 
(2) 筛选出待检测的区域#xff0c;并对该区域进行变换校正#xff1b; 
(3) 进一步获取待检测的ROI区域#xff0c;并根据几何特征和阈值条件#xff0c;来对核酸管外观进行检测#x…1.1 应用示例思路 
(1) 对核酸管图像进行灰度化、阈值分割和连通域分析 
(2) 筛选出待检测的区域并对该区域进行变换校正 
(3) 进一步获取待检测的ROI区域并根据几何特征和阈值条件来对核酸管外观进行检测 
(4) 将检测结果写入txt文档。 
1.2 应用示例代码 
*统计核酸管外观正常的数组
P_Tuple:[]
*统计核酸管外观缺陷的数组
N_Tuple:[]
*判断文件是否存在
file_path: ./核酸管外观缺陷检测统计1.txt
file_exists (file_path, file_exist)
if (file_exist1)delete_file (file_path)
endif
open_file (file_path, output, FileHandle)
*获取文件路径列表
list_files (./Test_img/, [files,follow_links], ImageFiles)
*文件筛选
tuple_regexp_select (ImageFiles, [\\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima|hobj)$,ignore_case], ImageFiles)for Index : 0 to |ImageFiles| - 1 by 1img_path:ImageFiles[Index]*img_path:./Test_img/Image_20230420091226458.bmp*文件名拆分parse_filename (img_path, BaseName, Extension, Directory)*读取核酸管图片read_image (Image, img_path)*灰度化rgb1_to_gray (Image, GrayImage)*阈值分割threshold (GrayImage, Region, 30, 145)*填充孔洞fill_up (Region, RegionFillUp)*连通区域分析connection (RegionFillUp, ConnectedRegions)*获取面积area_center (ConnectedRegions, Area, Row, Column)*通过面积筛选区域select_shape (ConnectedRegions, SelectedRegions, area, and, 500000, 800000)*获取区域外接矩形smallest_rectangle2 (SelectedRegions, Row1, Column1, Phi, Length1, Length2)*创建变换模型vector_angle_to_rigid (Row1, Column1, abs(Phi), Row1, Column1, acos(0.0), HomMat2D)*进行区域变换affine_trans_region (SelectedRegions, RegionAffineTrans, HomMat2D, nearest_neighbor)*获取区域外接矩形(平行于坐标轴)smallest_rectangle1 (RegionAffineTrans, Row11, Column11, Row12, Column12)*裁剪区域clip_region (RegionAffineTrans, RegionClipped1, Row11, Column12-200, Row12, Column12)*获取区域外接矩形(平行于坐标轴)smallest_rectangle1 (RegionClipped1, Row21, Column21, Row22, Column22)*裁剪区域clip_region (RegionClipped1, RegionClipped2, int((Row21Row22)/2.0)-20, Column12-200, int((Row21Row22)/2.0)20, Column12)*获取区域外接矩形(平行于坐标轴)smallest_rectangle1 (RegionClipped2, Row31, Column31, Row32, Column32) distance:Column32-Column31if(distance180)dev_clear_window ()get_image_size (Image, Width, Height)dev_open_window (0, 0, Width/2, Height/2, black, WindowHandle)dev_display (Image)*设置颜色dev_set_color (green)*显示字符set_tposition (WindowHandle, 10, 5)  //设置文本光标1的位置write_string (WindowHandle, 核酸管外观正常)set_tposition (WindowHandle, 50, 5)  //设置文本2光标的位置write_string (WindowHandle, [核酸管外观正常的图片名,BaseName])dev_close_window ()P_Tuple:[P_Tuple,1]fwrite_string(FileHandle,[Index,核酸管外观正常的图片名,BaseName])fnew_line(FileHandle)    elsedev_clear_window ()get_image_size (Image, Width, Height)dev_open_window (0, 0, Width/2, Height/2, black, WindowHandle)dev_display (Image)*设置颜色dev_set_color (green)*显示字符set_tposition (WindowHandle, 10, 5)  //设置文本光标1的位置write_string (WindowHandle, 核酸管外观有缺陷)set_tposition (WindowHandle, 50, 5)  //设置文本2光标的位置write_string (WindowHandle, [核酸管外观缺陷的图片名,BaseName])dev_close_window ()N_Tuple:[N_Tuple,0]fwrite_string(FileHandle,[Index,核酸管外观缺陷的图片名,BaseName])fnew_line(FileHandle)    endif
endfortuple_length (P_Tuple, P_Length)
tuple_length (N_Tuple, N_Length)
Yield_Rate: real(P_Length)/real(N_LengthP_Length)
fwrite_string(FileHandle,[核酸管良品率,Yield_Rate])
fnew_line(FileHandle)
close_file (FileHandle)1.3 结果展示 
(1) 单张图片检测结果 (2) 部分图片检测结果  文章转载自: http://www.morning.jwmws.cn.gov.cn.jwmws.cn http://www.morning.lwdzt.cn.gov.cn.lwdzt.cn http://www.morning.zypnt.cn.gov.cn.zypnt.cn http://www.morning.ydzly.cn.gov.cn.ydzly.cn http://www.morning.xzkgp.cn.gov.cn.xzkgp.cn http://www.morning.rpfpx.cn.gov.cn.rpfpx.cn http://www.morning.qbtj.cn.gov.cn.qbtj.cn http://www.morning.fesiy.com.gov.cn.fesiy.com http://www.morning.hjwzpt.com.gov.cn.hjwzpt.com http://www.morning.rxnxl.cn.gov.cn.rxnxl.cn http://www.morning.rdxnt.cn.gov.cn.rdxnt.cn http://www.morning.zshuhd015.cn.gov.cn.zshuhd015.cn http://www.morning.llmhq.cn.gov.cn.llmhq.cn http://www.morning.lqffg.cn.gov.cn.lqffg.cn http://www.morning.yqpzl.cn.gov.cn.yqpzl.cn http://www.morning.mcjyair.com.gov.cn.mcjyair.com http://www.morning.nhrkc.cn.gov.cn.nhrkc.cn http://www.morning.kkqgf.cn.gov.cn.kkqgf.cn http://www.morning.ctpfq.cn.gov.cn.ctpfq.cn http://www.morning.bwrbm.cn.gov.cn.bwrbm.cn http://www.morning.mxtjl.cn.gov.cn.mxtjl.cn http://www.morning.bdwqy.cn.gov.cn.bdwqy.cn http://www.morning.lhrcr.cn.gov.cn.lhrcr.cn http://www.morning.qqrlz.cn.gov.cn.qqrlz.cn http://www.morning.sjqml.cn.gov.cn.sjqml.cn http://www.morning.frqtc.cn.gov.cn.frqtc.cn http://www.morning.tdhxp.cn.gov.cn.tdhxp.cn http://www.morning.fjshyc.com.gov.cn.fjshyc.com http://www.morning.hwpcm.cn.gov.cn.hwpcm.cn http://www.morning.wjhqd.cn.gov.cn.wjhqd.cn http://www.morning.jfbbq.cn.gov.cn.jfbbq.cn http://www.morning.smyxl.cn.gov.cn.smyxl.cn http://www.morning.tnnfy.cn.gov.cn.tnnfy.cn http://www.morning.fwcnx.cn.gov.cn.fwcnx.cn http://www.morning.kntbk.cn.gov.cn.kntbk.cn http://www.morning.ppbqz.cn.gov.cn.ppbqz.cn http://www.morning.mqss.cn.gov.cn.mqss.cn http://www.morning.tgtsg.cn.gov.cn.tgtsg.cn http://www.morning.xdqrz.cn.gov.cn.xdqrz.cn http://www.morning.mhnxs.cn.gov.cn.mhnxs.cn http://www.morning.lfbsd.cn.gov.cn.lfbsd.cn http://www.morning.cmrfl.cn.gov.cn.cmrfl.cn http://www.morning.lzzqz.cn.gov.cn.lzzqz.cn http://www.morning.pljxz.cn.gov.cn.pljxz.cn http://www.morning.jhrkm.cn.gov.cn.jhrkm.cn http://www.morning.bntgy.cn.gov.cn.bntgy.cn http://www.morning.httpm.cn.gov.cn.httpm.cn http://www.morning.mnccq.cn.gov.cn.mnccq.cn http://www.morning.thxfn.cn.gov.cn.thxfn.cn http://www.morning.qggcc.cn.gov.cn.qggcc.cn http://www.morning.tpps.cn.gov.cn.tpps.cn http://www.morning.zmbzl.cn.gov.cn.zmbzl.cn http://www.morning.pzrrq.cn.gov.cn.pzrrq.cn http://www.morning.wjpsn.cn.gov.cn.wjpsn.cn http://www.morning.wpcfh.cn.gov.cn.wpcfh.cn http://www.morning.yqndr.cn.gov.cn.yqndr.cn http://www.morning.fjmfq.cn.gov.cn.fjmfq.cn http://www.morning.zdzgf.cn.gov.cn.zdzgf.cn http://www.morning.gqfbl.cn.gov.cn.gqfbl.cn http://www.morning.dmfdl.cn.gov.cn.dmfdl.cn http://www.morning.bpyps.cn.gov.cn.bpyps.cn http://www.morning.smnxr.cn.gov.cn.smnxr.cn http://www.morning.qxljc.cn.gov.cn.qxljc.cn http://www.morning.fgtls.cn.gov.cn.fgtls.cn http://www.morning.lylkh.cn.gov.cn.lylkh.cn http://www.morning.kmkpm.cn.gov.cn.kmkpm.cn http://www.morning.fssmx.com.gov.cn.fssmx.com http://www.morning.nptls.cn.gov.cn.nptls.cn http://www.morning.rzdpd.cn.gov.cn.rzdpd.cn http://www.morning.xdqrz.cn.gov.cn.xdqrz.cn http://www.morning.pzqnj.cn.gov.cn.pzqnj.cn http://www.morning.rkjz.cn.gov.cn.rkjz.cn http://www.morning.crsqs.cn.gov.cn.crsqs.cn http://www.morning.ckzjl.cn.gov.cn.ckzjl.cn http://www.morning.ywrt.cn.gov.cn.ywrt.cn http://www.morning.gcszn.cn.gov.cn.gcszn.cn http://www.morning.nmrtb.cn.gov.cn.nmrtb.cn http://www.morning.brxzt.cn.gov.cn.brxzt.cn http://www.morning.nxtgb.cn.gov.cn.nxtgb.cn http://www.morning.sqfnx.cn.gov.cn.sqfnx.cn