今天搞的功能是复现halcon的图像增强算子illuminate,根据文档其运作过程为
1.输入均值(低通)滤波矩阵size,输入Factor,原图灰度集in
2.滤波in得图像m
3.然后out= round ( (val - m) * Factor + in )
4.其中val在halcon帮助中描述为For byte-images val equals 127, for int2-images and uint2-images val equals the median value. 而这个byte-images、int2-images、uint2-images区分则是其图像类型,参考大佬http://www.skcircle.com/?id=1547,在opencvsharp中则分别对应了遍历图像Mat.Get(x, y)、Mat.Get(x, y)、Mat.Get(x, y)的值,而127也是0-255的中只所以选择该数值作为val。在本文中用到的图像类型默认是byte-images。
5.其中Factor与滤波器尺寸成正相关关系halcon说明中30x30到200x200的范围有以下几种组合
Height Width Factor
---------------------
40 40 0.55
100 100 0.7
150 150 0.8
6.综合上文,得知在低通滤波后图像将灰度中值比较,将其间差乘以因子Factor再加上原灰度值。让局部的灰度向灰度中值靠拢以达到增强图像的高频区域(边缘和拐角),使图像看起来更清晰的效果。原文:Very dark parts of the image are “illuminated” more strongly, very light ones are “darkened”.
halcon效果如图