halcon对光源打光不均匀进行平场矫正

在这里插入图片描述

* Image Acquisition 01: Code generated by Image Acquisition 01
*******预处理,生成RGB三通道的平场矫正的图像
*1.绘制检测ROI
*2.对检测的ROI进行平场矫正
*3.平场矫正方法采用均值对减方法
read_image (ImageWhite, 'C:/Users/Administrator/Desktop/平场矫正/Pic_2018_10_18_140633_blockId#639.bmp')



draw_rectangle1 (3600, Row1, Column1, Row2, Column2)
gen_rectangle1 (ROI_0, Row1, Column1, Row2, Column2)   




GenCorrectImg (ImageWhite, ROI_0, ImageCorrectionR, ImageCorrectionG, ImageCorrectionB)






* list_files ('C:/Users/Administrator/Desktop/平场矫正', ['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 1
*     read_image (Image, ImageFiles[Index])
*     decompose3 (Image, Image1, Image2, Image3)
*     add_image (Image1, ImageSubR, ImageResultR, 1, -30)
*     stop()
*     add_image (Image2, ImageSubG, ImageResultG, 1, -30)
*     stop()
*     add_image (Image3, ImageSubB, ImageResultB, 1, -30)
    
    
    
    
    
    
*     sub_image (Image1, ImageBR, ImageSub1, 1, 0)
*     convert_image_type (ImageSub1, ImageSub1Float, 'real')
*     mult_image(ImageSub1Float,ImageKR,ImageResult1,1,0)
*     convert_image_type (ImageResult1, ImageResultByte, 'byte')
    
*     dev_clear_window()
*     dev_display(Image1)
*     stop()
*     dev_display(ImageResultByte)
*     stop()
*     add_image (Image1, ImageCorrection, ImageResult, 1, -40)
    
    
*     stop()
*     mean_image (ImageResult, ImageMean1, Width, Height)
*     sub_image (ImageMean1, ImageResult, ImageSub1, 1, 0)
    
    
*     stop()
    * Image Acquisition 01: Do something
* endfor

猜你喜欢

转载自blog.csdn.net/cashmood/article/details/111941918