[快速閱讀七] Halcon裡emphasize函式相關資料.

Imageshop發表於2024-06-11

  時不時有人問我我的SSE最佳化Demo裡emphasize(邊緣強調)的原理是啥,有沒有寫部落格,其實不是我不願意寫部落格,而是那個東西太過於簡單,我不想寫部落格。但是耐不住問的人多了,我就乾脆複製點資料放在部落格裡吧,省的每次我還要去找點資料複製給人家。

   這個東西其實是Halcon裡的一個運算元,我也是直接借用了他的一個英文名字並翻譯的,在Halcon的幫助文件裡,其說法如下所示:

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裡是用的均值模糊,實際也可以用高斯模糊或者其他型別的模糊,這個東西的效果和半徑以及增強的係數有關。

  

相關文章