detect_mura_defects_blur.hdev例程解析

  • this example shows how to detect mura defects
  • in blurred images

dev_close_window ()
dev_update_off ()
Path := ‘C:/Users/shang/Desktop/新建文件夹2/Image_’
read_image (Image, Path + ‘01’)
get_image_size (Image, Width, Height)
dev_open_window_fit_size (0, 0, Width, Height, 640, 480, WindowHandle)
set_display_font (WindowHandle, 14, ‘mono’, ‘true’, ‘false’)
dev_set_draw (‘margin’)
dev_set_line_width (3)
dev_set_color (‘red’)
ScaleFactor := 0.4
calculate_lines_gauss_parameters (17, [25,3], Sigma, Low, High)
for f := 1 to 3 by 1
read_image (Image, Path + f$’.2i’)
*decompose3 (Image, R, G, B)
* correct side illumination
*傅里叶变换
rft_generic (Image, ImageFFT, ‘to_freq’, ‘none’, ‘complex’, Width)
*生成高斯滤波器
gen_gauss_filter (ImageGauss, 100, 100, 0, ‘n’, ‘rft’, Width, Height)
*高斯滤波器卷积
convol_fft (ImageFFT, ImageGauss, ImageConvol)
*傅里叶变换
rft_generic (ImageConvol, ImageFFT1, ‘from_freq’, ‘none’, ‘byte’, Width)
*两幅图像做减法运算
sub_image (Image, ImageFFT1, ImageSub, 2, 100)
*将图像ImageSub进行放大观察,ImageZoomed为放大后的图像,ScaleFactor, ScaleFactor为长宽放大加数,
*constant为插值方法。
zoom_image_factor (ImageSub, ImageZoomed, ScaleFactor, ScaleFactor, ‘constant’)
* 获取一幅图的区域,目的为避免边框对lines_gauss的影响。
get_domain (ImageZoomed, Domain)
*腐蚀,
erosion_rectangle1 (Domain, RegionErosion, 7, 7)
*在图像ImageZoomed截取RegionErosion大小图片,存放到变量ImageReduced
reduce_domain (ImageZoomed, RegionErosion, ImageReduced)
*检测图像的线条与宽度。ImageReduced, Lines为输入图像与输出的亚像素线条,
*Sigma为高斯平滑系数, Low为后滞阈值分隔低值, High为前置阈值分割高值,
*'dark’表示 提取图像 中的暗线条, 'true’表示 是否提取线条 宽度, 'gaussian’提取线条的模式,
*gaussian在线条不锐利时使用, 'true’表示添加 能够 提取的接合点。
lines_gauss (ImageReduced, Lines, Sigma, Low, High, ‘dark’, ‘true’, ‘gaussian’, ‘true’)
*生成齐次转换矩阵
hom_mat2d_identity (HomMat2DIdentity)
*添加缩放的齐次转换矩阵,HomMat2DIdentity为输入矩阵,
*1 / ScaleFactor, 1 / ScaleFactor为缩放因数, HomMat2DScale为输出的矩阵。
hom_mat2d_scale_local (HomMat2DIdentity, 1 / ScaleFactor, 1 / ScaleFactor, HomMat2DScale)
*对亚像素直线Lines进行仿射变换。
affine_trans_contour_xld (Lines, Defects, HomMat2DScale)
*
dev_display (Image)
dev_display (Defects)
if (f < 3)
disp_continue_message (WindowHandle, ‘black’, ‘true’)
stop ()
endif
endfor

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
suricata中void DetectHttpUriRegister (void) { /* http_uri content modifier / sigmatch_table[DETECT_AL_HTTP_URI].name = "http_uri"; sigmatch_table[DETECT_AL_HTTP_URI].desc = "content modifier to match specifically and only on the HTTP uri-buffer"; sigmatch_table[DETECT_AL_HTTP_URI].url = "/rules/http-keywords.html#http-uri-and-http-uri-raw"; sigmatch_table[DETECT_AL_HTTP_URI].Setup = DetectHttpUriSetup; #ifdef UNITTESTS sigmatch_table[DETECT_AL_HTTP_URI].RegisterTests = DetectHttpUriRegisterTests; #endif sigmatch_table[DETECT_AL_HTTP_URI].flags |= SIGMATCH_NOOPT|SIGMATCH_INFO_CONTENT_MODIFIER; sigmatch_table[DETECT_AL_HTTP_URI].alternative = DETECT_HTTP_URI; / http.uri sticky buffer / sigmatch_table[DETECT_HTTP_URI].name = "http.uri"; sigmatch_table[DETECT_HTTP_URI].alias = "http.uri.normalized"; sigmatch_table[DETECT_HTTP_URI].desc = "sticky buffer to match specifically and only on the normalized HTTP URI buffer"; sigmatch_table[DETECT_HTTP_URI].url = "/rules/http-keywords.html#http-uri-and-http-uri-raw"; sigmatch_table[DETECT_HTTP_URI].Setup = DetectHttpUriSetupSticky; sigmatch_table[DETECT_HTTP_URI].flags |= SIGMATCH_NOOPT|SIGMATCH_INFO_STICKY_BUFFER; DetectAppLayerInspectEngineRegister2("http_uri", ALPROTO_HTTP1, SIG_FLAG_TOSERVER, HTP_REQUEST_LINE, DetectEngineInspectBufferGeneric, GetData); DetectAppLayerMpmRegister2("http_uri", SIG_FLAG_TOSERVER, 2, PrefilterGenericMpmRegister, GetData, ALPROTO_HTTP1, HTP_REQUEST_LINE); DetectAppLayerInspectEngineRegister2("http_uri", ALPROTO_HTTP2, SIG_FLAG_TOSERVER, HTTP2StateDataClient, DetectEngineInspectBufferGeneric, GetData2); DetectAppLayerMpmRegister2("http_uri", SIG_FLAG_TOSERVER, 2, PrefilterGenericMpmRegister, GetData2, ALPROTO_HTTP2, HTTP2StateDataClient); DetectBufferTypeSetDescriptionByName("http_uri", "http request uri"); DetectBufferTypeRegisterSetupCallback("http_uri", DetectHttpUriSetupCallback); DetectBufferTypeRegisterValidateCallback("http_uri", DetectHttpUriValidateCallback); g_http_uri_buffer_id = DetectBufferTypeGetByName("http_uri"); 每一句都加上详细的注释
05-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值