时不时有人问我我的SSE优化Demo里emphasize(边缘强调)的原理是啥,有没有写博客,其实不是我不愿意写博客,而是那个东西太过于简单,我不想写博客。但是耐不住问的人多了,我就干脆复制点资料放在博客里吧,省的每次我还要去找点资料复制给人家。
这个东西其实是Halcon里的一个算子,我也是直接借用了他的一个英文名字并翻译的,在Halcon的帮助文档里,其说法如下所示:
代码语言:javascript复制emphasize (Operator)
Name
emphasize — Enhance contrast of the image.
Signature
emphasize(Image : ImageEmphasize : MaskWidth, MaskHeight, Factor : )
Description
The operator emphasize emphasizes high frequency areas of the image (edges and corners). The resulting images appears sharper.
First the procedure carries out a filtering with the low pass (mean_image). The resulting gray values (res) are calculated from the obtained gray values (mean) and the original gray values (orig) as follows:
res := round((orig - mean) * Factor) orig
Factor serves as measurement of the increase in contrast. The division frequency is determined via the size of the filter matrix: The larger the matrix, the lower the disivion frequency.
As an edge treatment the gray values are mirrored at the edges of the image. Overflow and/or underflow of gray values is clipped.
这东西就是一个最为简单的锐化算子,依赖于模糊,由模糊数据和原始数据的差值得到边缘信息,然后再根据用户输入的系数对边缘信息进行放大,加到原始信息中,从而起到增强边缘或者角点的作用。
注意,溢出的值需要直接Clip。
Halcon里是用的均值模糊,实际也可以用高斯模糊或者其他类型的模糊,这个东西的效果和半径以及增强的系数有关。