Documentation ¶
Overview ¶
Package filterx 模糊
Package filterx 模糊
Package filterx 二值化
Package filterx 膨胀
Package filterx 边缘化
Package filterx 浮雕
Package filterx 腐蚀
Package filterx RGBA转RGB
Package filterx 锐化
Index ¶
- Variables
- func BlurWithAverage3(srcImg image.Image, dstImg draw.Image) error
- func BlurWithBoxEight(srcImg image.Image, dstImg draw.Image, radius int, includeCenter bool) error
- func BlurWithBoxFour(srcImg image.Image, dstImg draw.Image, radius int, includeCenter bool) error
- func BlurWithEightNear3(srcImg image.Image, dstImg draw.Image) error
- func BlurWithForeNear3(srcImg image.Image, dstImg draw.Image) error
- func BlurWithGauss(srcImg image.Image, dstImg draw.Image, radius int, sigma float64) error
- func BlurWithGauss3(srcImg image.Image, dstImg draw.Image) error
- func BlurWithGauss5(srcImg image.Image, dstImg draw.Image) error
- func BlurWithMotion(srcImg image.Image, dstImg draw.Image, radius int, ...) error
- func BlurWithMotion3Horizontal(srcImg image.Image, dstImg draw.Image) error
- func BlurWithMotion3Oblique135(srcImg image.Image, dstImg draw.Image) error
- func BlurWithMotion3Oblique45(srcImg image.Image, dstImg draw.Image) error
- func BlurWithMotion3Vertical(srcImg image.Image, dstImg draw.Image) error
- func CVTGray(graySrcImg image.Image, grayDstImg draw.Image, threshold uint32) error
- func CVTGrayImageWithKittle(srcImg image.Image, dstImg draw.Image) error
- func CVTWithOTSU(srcImg image.Image, dstImg draw.Image) error
- func CVTWithOTSU64(srcImg image.Image, dstImg draw.Image) error
- func DilateCVT(cvtSrcImg image.Image, cvtDstImg draw.Image, directions imagex.PixelDirection) error
- func DilateGray(graySrcImg image.Image, grayDstImg draw.Image, ...) error
- func EdgeCustom(srcImg image.Image, dstImg draw.Image, radius int, ...) error
- func EdgeWithCustomLaplace4(srcImg image.Image, dstImg draw.Image, radius int) error
- func EdgeWithCustomLaplace8(srcImg image.Image, dstImg draw.Image, radius int) error
- func EdgeWithLR(srcImg image.Image, dstImg draw.Image) error
- func EdgeWithLaplace4(srcImg image.Image, dstImg draw.Image) error
- func EdgeWithLaplace8(srcImg image.Image, dstImg draw.Image) error
- func EdgeWithLdRu(srcImg image.Image, dstImg draw.Image) error
- func EdgeWithLuRd(srcImg image.Image, dstImg draw.Image) error
- func EdgeWithUD(srcImg image.Image, dstImg draw.Image) error
- func ErodeCVT(cvtSrcImg image.Image, cvtDstImg draw.Image, directions imagex.PixelDirection) error
- func ErodeGray(graySrcImg image.Image, grayDstImg draw.Image, ...) error
- func FastBlur(srcImg image.Image, dstImg draw.Image, radius int) error
- func FastBlur2(srcImg image.Image, dstImg draw.Image, radius int) error
- func FastBlur3(srcImg image.Image, dstImg draw.Image, radius int) error
- func FastBlur64(srcImg image.Image, dstImg draw.Image, radius int) error
- func FastBlurARGB8888(srcImg image.Image, dstImg draw.Image, radius int) error
- func FastBlur_Java(srcImg image.Image, dstImg draw.Image, radius int) error
- func FilterImageWithMatrix(srcImg image.Image, dstImg draw.Image, m FilterMatrix) error
- func GetGray16Pixel(grayImg *image.Gray16) (pixel [][]uint16)
- func GetGrayPixel(grayImg *image.Gray) (pixel [][]uint8)
- func GetKittleThresholdAtGreen(grayImg image.Image) (threshold uint32)
- func GetOtsuThreshold(grayImg image.Image) (threshold uint32)
- func GetOtsuThreshold64(grayImg image.Image) (threshold uint32)
- func GrayDefaultFromNRGBA(src image.Image) (resultImage image.Image, err error)
- func GrayDefaultFromRGBA(src image.Image, backgroundColor color.Color) (resultImage image.Image, err error)
- func GrayFromNRGBA(rgbImg image.Image, algMode graphicx.GrayAlgMode) (resultImage image.Image, err error)
- func GrayFromRGBA(rgbaImg image.Image, background color.Color, algMode graphicx.GrayAlgMode) (resultImage image.Image, err error)
- func NRGBAAt(rgbaImg image.Image, nrgbaImg draw.Image, backgroundColor color.Color) error
- func NRGBAAtBlack(rgbaImg image.Image, nrgbaImg draw.Image) error
- func NRGBAAtGreen(rgbaImg image.Image, nrgbaImg draw.Image) error
- func NRGBAAtWhite(rgbaImg image.Image, nrgbaImg draw.Image) error
- func SharpenWithCustomLaplace(srcImg image.Image, dstImg draw.Image, radius int, ...) error
- func SharpenWithLaplace4(srcImg image.Image, dstImg draw.Image) error
- func SharpenWithLaplace8(srcImg image.Image, dstImg draw.Image) error
- func SharpenWithSharpen5All(srcImg image.Image, dstImg draw.Image) error
- func SharpenWithStrengthen3(srcImg image.Image, dstImg draw.Image) error
- type EmbossDirection
- type FilterKernel
- func (fk FilterKernel) Clone() FilterKernel
- func (fk FilterKernel) FlipLR() FilterKernel
- func (fk FilterKernel) FlipLRSelf()
- func (fk FilterKernel) FlipUD() FilterKernel
- func (fk FilterKernel) FlipUDSelf()
- func (fk FilterKernel) Len() int
- func (fk FilterKernel) Less(i, j int) bool
- func (fk FilterKernel) Rotate(clockwise bool, count90 int) FilterKernel
- func (fk FilterKernel) Rotate90(clockwise bool) FilterKernel
- func (fk FilterKernel) Rotate90Self(clockwise bool)
- func (fk FilterKernel) RotateSelf(clockwise bool, count90 int)
- func (fk FilterKernel) Sorted()
- func (fk FilterKernel) Swap(i, j int)
- type FilterMatrix
- func CreateAsymmetricalEmbossFilter(radius int, value int, offset int, angle int) (filter FilterMatrix, err error)
- func CreateBoxEightNearBlurFilter(radius int, includeCenter bool) (filter FilterMatrix, err error)
- func CreateBoxFourNearBlurFilter(radius int, includeCenter bool) (filter FilterMatrix, err error)
- func CreateEdgeFilter(radius int, direction imagex.PixelDirection, diff uint) (filter FilterMatrix, err error)
- func CreateEdgeLaplace4Filter(radius int) (filter FilterMatrix, err error)
- func CreateEdgeLaplace8Filter(radius int) (filter FilterMatrix, err error)
- func CreateEmbossFilterSymmetry(radius int, direction EmbossDirection, offset int) (filter FilterMatrix, err error)
- func CreateGaussBlurFilter(radius int, sigma float64) (filter FilterMatrix, err error)
- func CreateMotionBlurFilter(radius int, direction imagex.PixelDirection) (filter FilterMatrix, err error)
- func CreateSharpenFilter(radius int, direction imagex.PixelDirection, diff uint) (filter FilterMatrix, err error)
- func CreateSharpenLaplace4Filter(radius int) (filter FilterMatrix, err error)
- func CreateSharpenLaplace8Filter(radius int) (filter FilterMatrix, err error)
- type KernelVector
Constants ¶
This section is empty.
Variables ¶
var ( // BoxFourNear3 // 3x3 4邻域均值滤波器 BoxFourNear3 = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 4, Kernel: []KernelVector{ {0, -1, 1}, {-1, 0, 1}, {1, +0, 1}, {+0, 1, 1}, {0, 0, 1}}} // BoxEightNear3 // 3x3 8邻域均值滤波器 BoxEightNear3 = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 8, Kernel: []KernelVector{ {-1, -1, 1}, {0, -1, 1}, {1, -1, 1}, {-1, +0, 1}, {1, +0, 1}, {-1, +1, 1}, {0, +1, 1}, {1, +1, 1}}} // BoxAverage3 // 3x3 均值滤波器 BoxAverage3 = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 9, Kernel: []KernelVector{ {-1, -1, 1}, {0, -1, 1}, {1, -1, 1}, {-1, +0, 1}, {0, +0, 1}, {1, +0, 1}, {-1, +1, 1}, {0, +1, 1}, {1, +1, 1}}} )
均值模糊滤波器
var ( // Gauss3 // 3x3 高斯滤波器 Gauss3 = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 16, Kernel: []KernelVector{ {-1, -1, 1}, {0, -1, 2}, {1, -1, 1}, {-1, +0, 2}, {0, +0, 4}, {1, +0, 2}, {-1, +1, 1}, {0, +1, 2}, {1, +1, 1}}} // Gauss5 // 5x5 高斯滤波器 Gauss5 = FilterMatrix{KernelRadius: 2, KernelSize: 5, KernelScale: 273, Kernel: []KernelVector{ {-2, -2, 1}, {-1, -2, 4}, {0, -2, 7}, {1, -2, 4}, {2, -2, 1}, {-2, -1, 4}, {-1, -1, 16}, {0, -1, 26}, {1, -1, 16}, {2, -1, 4}, {-2, +0, 7}, {-1, +0, 26}, {0, +0, 41}, {1, +0, 26}, {2, +0, 7}, {-2, +1, 4}, {-1, +1, 16}, {0, +1, 26}, {1, +1, 16}, {2, +1, 4}, {-2, +2, 1}, {-1, +2, 4}, {1, +2, 7}, {1, +2, 4}, {2, +2, 1}}} )
高斯模糊滤波器
var ( // Motion3Horizontal // 3x3水平运动滤波器 Motion3Horizontal = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 3, Kernel: []KernelVector{ {-1, 0, 1}, {0, 0, 1}, {1, 0, 1}}} // Motion3Vertical // 3x3垂直运动滤波器 Motion3Vertical = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 3, Kernel: []KernelVector{ {0, -1, 1}, {0, 0, 1}, {0, 1, 1}}} // Motion3Oblique45 // 3x3 45度运动滤波器(左上右下) Motion3Oblique45 = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 3, Kernel: []KernelVector{ {1, -1, 1}, {0, +0, 1}, {-1, +1, 1}}} // Motion3Oblique135 // 3x3 135度运动滤波器(左下右上) Motion3Oblique135 = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 3, Kernel: []KernelVector{ {-1, -1, 1}, {0, 0, 1}, {1, 1, 1}}} )
运动模糊滤波器
var ( // Edge5LR 5x5 左右边缘滤波器 Edge5LR = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 0, Kernel: []KernelVector{ {-2, 0, -1}, {-1, 0, -1}, {0, 0, 4}, {1, 0, -1}, {2, 0, -1}}} // Edge5UD 5x5 上下边缘滤波器 Edge5UD = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 0, Kernel: []KernelVector{ {0, -2, -1}, {0, -1, -1}, {0, 0, 4}, {0, 1, -1}, {0, 2, -1}}} // Edge5LuRd 5x5 左上右下边缘滤波器 Edge5LuRd = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 0, Kernel: []KernelVector{ {-2, -2, -1}, {-1, -1, -1}, {0, 0, 4}, {1, 1, -1}, {1, 2, -1}}} // Edge5LdRu 5x5 左下右上边缘滤波器 Edge5LdRu = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 0, Kernel: []KernelVector{ {-2, 2, -1}, {-1, 1, -1}, {0, 0, 4}, {1, -1, -1}, {2, -2, -1}}} // Edge3Laplace4 3x3 Laplace拉普拉斯4邻滤波器 Edge3Laplace4 = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 0, Kernel: []KernelVector{ {0, -1, -1}, {-1, +0, -1}, {0, +0, +4}, {1, +0, -1}, {0, +1, -1}}} // Edge3Laplace8 5x5 Laplace拉普拉斯8邻滤波器 Edge3Laplace8 = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 0, Kernel: []KernelVector{ {-1, -1, -1}, {0, -1, -1}, {1, -1, -1}, {-1, +0, -1}, {0, +0, +8}, {1, +0, -1}, {-1, +1, -1}, {0, +1, -1}, {1, +1, -1}}} )
边缘滤波器
var ( // Emboss3Lu2Rd 3x3 (左上->右下)浮雕滤波器 Emboss3Lu2Rd = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 0, ResultOffset: 32768, Kernel: []KernelVector{ {-1, -1, -1}, {-0, -1, -1}, {-1, -0, -1}, {+1, +0, +1}, {+0, +1, +1}, {+1, +1, +1}}} // Emboss3U2D 3x3 (上->下)浮雕滤波器 Emboss3U2D = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 0, ResultOffset: 32768, Kernel: []KernelVector{ {-1, -1, -1}, {0, -1, -1}, {+1, -1, -1}, {-1, +1, +1}, {0, +1, +1}, {+1, +1, +1}}} // Emboss5Lu2Rd 5x5 (左上->右下)浮雕滤波器 Emboss5Lu2Rd = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 0, ResultOffset: 32768, Kernel: []KernelVector{ {-2, -2, -1}, {-1, -2, -1}, {+0, -2, -1}, {+1, -2, -1}, {-2, -1, -1}, {-1, -1, -1}, {+0, -1, -1}, {+2, -1, +1}, {-2, -0, -1}, {-1, -0, -1}, {+1, -0, +1}, {+2, -0, +1}, {-2, +1, -1}, {+0, +1, +1}, {+1, +1, +1}, {+2, +1, +1}, {-1, +2, +1}, {+0, +2, +1}, {+1, +2, +1}, {+2, +2, +1}}} // Emboss5U2D 5x5 (上->下)浮雕滤波器 Emboss5U2D = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 0, ResultOffset: 32768, Kernel: []KernelVector{ {-2, -2, -1}, {-1, -2, -1}, {0, -2, -1}, {+1, -2, -1}, {+2, -2, -1}, {-2, -1, -1}, {-1, -1, -1}, {0, -1, -1}, {+1, -0, -1}, {+2, -1, -1}, {-2, +1, +1}, {-1, +1, +1}, {0, +1, +1}, {+1, +1, +1}, {+2, +1, +1}, {-2, +2, +1}, {-1, +2, +1}, {0, +2, +1}, {+1, +2, +1}, {+2, +2, +1}}} // Emboss3Asymmetrical 3x3 非对称浮雕滤波器 Emboss3Asymmetrical = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 0, ResultOffset: 32768, Kernel: []KernelVector{ {-1, -1, 2}, {+0, +0, -1}, {+1, +1, -1}}} )
浮雕滤波器
var ( // Sharpen3Laplace4 // 3x3 简单锐化滤波器(拉普拉斯4邻滤波器) Sharpen3Laplace4 = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 1, Kernel: []KernelVector{ {0, -1, -1}, {-1, +0, -1}, {0, +0, +5}, {1, +0, -1}, {0, +1, -1}}} // Sharpen3Laplace8 // 3x3 锐化滤波器(拉普拉斯8邻滤波器) Sharpen3Laplace8 = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 1, Kernel: []KernelVector{ {-1, -1, -1}, {0, -1, -1}, {1, -1, -1}, {-1, +0, -1}, {0, +0, +9}, {1, +0, -1}, {-1, +1, -1}, {0, +1, -1}, {1, +1, -1}}} // SharpenStrengthen3All // 3x3 全方向锐化滤波器(强调边缘) SharpenStrengthen3All = FilterMatrix{KernelRadius: 1, KernelSize: 3, KernelScale: 1, Kernel: []KernelVector{ {-1, -1, +1}, {0, -1, +1}, {1, -1, +1}, {-1, +0, +1}, {0, +0, -7}, {1, +0, +1}, {-1, +1, +1}, {0, +1, +1}, {1, +1, +1}}} // Sharpen5All // 5x5 全方向锐化滤波器 Sharpen5All = FilterMatrix{KernelRadius: 2, KernelSize: 5, KernelScale: 1, Kernel: []KernelVector{ {-2, -2, -1}, {-1, -2, -1}, {0, -2, -1}, {1, -2, -1}, {2, -2, -1}, {-2, -1, -1}, {-1, -1, +2}, {0, -1, +2}, {1, -1, +2}, {2, -1, -1}, {-2, +0, -1}, {-1, +0, +2}, {0, +0, +1}, {1, +0, +2}, {2, +0, -1}, {-2, +1, -1}, {-1, +1, +2}, {0, +1, +2}, {1, +1, +2}, {2, +1, -1}, {-2, +2, -1}, {-1, +2, -1}, {1, +2, -1}, {1, +2, -1}, {2, +2, -1}}} )
锐化滤波器
Functions ¶
func BlurWithAverage3 ¶
BlurWithAverage3 均值模糊
func BlurWithBoxEight ¶
BlurWithBoxEight 自定义8邻均值模糊
func BlurWithBoxFour ¶
BlurWithBoxFour 自定义4邻均值模糊
func BlurWithEightNear3 ¶
BlurWithEightNear3 8邻域均值模糊
func BlurWithForeNear3 ¶
BlurWithForeNear3 4邻域均值模糊
func BlurWithGauss ¶
BlurWithGauss 自定义高斯模糊
func BlurWithGauss3 ¶
BlurWithGauss3 高斯3x3模糊
func BlurWithGauss5 ¶
BlurWithGauss5 高斯5x5模糊
func BlurWithMotion ¶
func BlurWithMotion(srcImg image.Image, dstImg draw.Image, radius int, direction imagex.PixelDirection) error
BlurWithMotion 自定义运动模糊
func BlurWithMotion3Horizontal ¶
BlurWithMotion3Horizontal 水平运动模糊
func BlurWithMotion3Oblique135 ¶
BlurWithMotion3Oblique135 斜135角运动模糊
func BlurWithMotion3Oblique45 ¶
BlurWithMotion3Oblique45 斜45角运动模糊
func BlurWithMotion3Vertical ¶
BlurWithMotion3Vertical 垂直运动模糊
func CVTGrayImageWithKittle ¶
CVTGrayImageWithKittle Kittle二值化算法(灰度拉伸)
func CVTWithOTSU ¶
CVTWithOTSU OTSU二值化算法(大津法)
func CVTWithOTSU64 ¶
CVTWithOTSU64 OTSU二值化算法(大津法)
func DilateGray ¶
func DilateGray(graySrcImg image.Image, grayDstImg draw.Image, directions imagex.PixelDirection, threshold uint32) error
DilateGray 膨胀灰度图像(用于普通灰度图意义不太,二值图的效果不错) 阈值threshold, 只有<=threshold的像素点才会向外发生膨胀 阈值threshold范围[0,65535] directions为允许膨胀的方向
func EdgeCustom ¶
func EdgeCustom(srcImg image.Image, dstImg draw.Image, radius int, direction imagex.PixelDirection, diff uint) error
EdgeCustom 使用自定义边缘滤波器处理图像
func EdgeWithCustomLaplace4 ¶
EdgeWithCustomLaplace4 使用自定义拉普拉斯4邻边缘滤波器处理图像
func EdgeWithCustomLaplace8 ¶
EdgeWithCustomLaplace8 使用自定义拉普拉斯8邻边缘滤波器处理图像
func EdgeWithLR ¶
EdgeWithLR 使用左右边缘滤波器处理图像
func EdgeWithLaplace4 ¶
EdgeWithLaplace4 使用全方向边缘滤波器处理图像
func EdgeWithLaplace8 ¶
EdgeWithLaplace8 使用全方向边缘滤波器处理图像
func EdgeWithLdRu ¶
EdgeWithLdRu 使用左下右上边缘滤波器处理图像
func EdgeWithLuRd ¶
EdgeWithLuRd 使用左上右下边缘滤波器处理图像
func EdgeWithUD ¶
EdgeWithUD 使用上下边缘滤波器处理图像
func ErodeGray ¶
func ErodeGray(graySrcImg image.Image, grayDstImg draw.Image, directions imagex.PixelDirection, erodeThreshold uint32, antiErodeThreshold uint32) error
ErodeGray 腐蚀灰度图像 腐蚀阈值erodeThreshold (0,65535]
>=erodeThreshold像素的点才具有腐蚀性 erodeThreshold=1时只要不是纯黑都具有腐蚀性,erodeThreshold=65535时只有纯白具有腐蚀性
抗腐蚀阈值antiErodeThreshold [0, 65535)
<antiErodeThreshold的像素点不会被腐蚀, antiErodeThreshold=0时不抗腐蚀
要求 erodeThreshold > antiErodeThreshold
func FastBlur64 ¶ added in v1.0.3
FastBlur64 模糊
func FastBlurARGB8888 ¶ added in v1.0.3
FastBlurARGB8888 堆模糊(快速模糊) https://www.cnblogs.com/Darksun/p/4681476.html FastBlurDemo.zip
func FastBlur_Java ¶ added in v1.0.3
FastBlur_Java FastBlur.java
func FilterImageWithMatrix ¶
FilterImageWithMatrix 使用滤波器
func GetGray16Pixel ¶
func GetGrayPixel ¶
func GetKittleThresholdAtGreen ¶
GetKittleThresholdAtGreen 计算Kittler算法的阈值 64位图像阈值 threshold [0, 65535]
func GetOtsuThreshold ¶
GetOtsuThreshold 计算灰度图的OTSU算法的阈值 64位像素强制转为32位像素参与计算 结果返回64位图像级阈值 threshold [0, 65535]
func GetOtsuThreshold64 ¶
GetOtsuThreshold64 计算灰度图的OTSU算法的阈值 结果返回64位图像级阈值 threshold [0, 65535]
func GrayDefaultFromNRGBA ¶
GrayDefaultFromNRGBA 转制NRGBA图像为Gray16灰度图 使用默认灰度计算算法
func GrayDefaultFromRGBA ¶
func GrayDefaultFromRGBA(src image.Image, backgroundColor color.Color) (resultImage image.Image, err error)
GrayDefaultFromRGBA 转制RGBA图像为Gray16灰度图 使用默认灰度计算算法
func GrayFromNRGBA ¶
func GrayFromNRGBA(rgbImg image.Image, algMode graphicx.GrayAlgMode) (resultImage image.Image, err error)
GrayFromNRGBA 转制NRGBA图像为Gray16灰度图
func GrayFromRGBA ¶
func GrayFromRGBA(rgbaImg image.Image, background color.Color, algMode graphicx.GrayAlgMode) (resultImage image.Image, err error)
GrayFromRGBA 转制RGBA图像为Gray16灰度图
func NRGBAAtBlack ¶ added in v1.0.4
NRGBAAtBlack 以黑色(Black)作底转换RGBA图像为RGB图像(去Alpha通道)
func NRGBAAtGreen ¶ added in v1.0.4
NRGBAAtGreen 以绿色(Green)作底转换RGBA图像为RGB图像(去Alpha通道)
func NRGBAAtWhite ¶ added in v1.0.4
NRGBAAtWhite 以白色(White)作底转换RGBA图像为RGB图像(去Alpha通道)
func SharpenWithCustomLaplace ¶
func SharpenWithCustomLaplace(srcImg image.Image, dstImg draw.Image, radius int, direction imagex.PixelDirection) error
SharpenWithCustomLaplace 使用定制的拉普拉斯锐化滤波器处理图像
func SharpenWithLaplace4 ¶
SharpenWithLaplace4 使用拉普拉斯4邻锐化滤波器处理图像
func SharpenWithLaplace8 ¶
SharpenWithLaplace8 使用拉普拉斯4邻锐化滤波器处理图像
func SharpenWithSharpen5All ¶
SharpenWithSharpen5All 使用强调边缘滤波器处理图像
Types ¶
type EmbossDirection ¶
type EmbossDirection int
const ( Lu2Rd EmbossDirection = iota Ru2Ld Rd2Lu Ld2Ru U2D R2L D2U L2R )
以下顺序不能乱
type FilterKernel ¶
type FilterKernel []KernelVector
func (FilterKernel) Clone ¶
func (fk FilterKernel) Clone() FilterKernel
func (FilterKernel) Len ¶
func (fk FilterKernel) Len() int
func (FilterKernel) Less ¶
func (fk FilterKernel) Less(i, j int) bool
func (FilterKernel) Rotate ¶
func (fk FilterKernel) Rotate(clockwise bool, count90 int) FilterKernel
Rotate 旋转
func (FilterKernel) Rotate90 ¶
func (fk FilterKernel) Rotate90(clockwise bool) FilterKernel
Rotate90 旋转90度 clockwise ;是否为顺时针
func (FilterKernel) Rotate90Self ¶
func (fk FilterKernel) Rotate90Self(clockwise bool)
Rotate90Self 旋转90度 clockwise ;是否为顺时针
func (FilterKernel) RotateSelf ¶
func (fk FilterKernel) RotateSelf(clockwise bool, count90 int)
RotateSelf 旋转
func (FilterKernel) Swap ¶
func (fk FilterKernel) Swap(i, j int)
type FilterMatrix ¶
type FilterMatrix struct { // 滤波器卷积核 Kernel FilterKernel // 滤波器半径 KernelRadius int // 滤波器边长 KernelSize int // 滤波器卷积核倍率 KernelScale int // 运算结果偏移量 ResultOffset int }
FilterMatrix 滤波器
func CreateAsymmetricalEmbossFilter ¶
func CreateAsymmetricalEmbossFilter(radius int, value int, offset int, angle int) (filter FilterMatrix, err error)
CreateAsymmetricalEmbossFilter 创建对称浮雕滤波器
func CreateBoxEightNearBlurFilter ¶
func CreateBoxEightNearBlurFilter(radius int, includeCenter bool) (filter FilterMatrix, err error)
CreateBoxEightNearBlurFilter 创建自定义8邻均值模糊滤波器 radius 半径 includeCenter 包含中心
func CreateBoxFourNearBlurFilter ¶
func CreateBoxFourNearBlurFilter(radius int, includeCenter bool) (filter FilterMatrix, err error)
CreateBoxFourNearBlurFilter 创建自定义4邻均值模糊滤波器 radius 半径 includeCenter 包含中心
func CreateEdgeFilter ¶
func CreateEdgeFilter(radius int, direction imagex.PixelDirection, diff uint) (filter FilterMatrix, err error)
CreateEdgeFilter 创建边缘检测滤波器 radius: 卷积核半径 direction: 运动方向 diff: 梯度差
func CreateEdgeLaplace4Filter ¶
func CreateEdgeLaplace4Filter(radius int) (filter FilterMatrix, err error)
CreateEdgeLaplace4Filter 创建拉普拉斯4邻边缘检测滤波器
func CreateEdgeLaplace8Filter ¶
func CreateEdgeLaplace8Filter(radius int) (filter FilterMatrix, err error)
CreateEdgeLaplace8Filter 创建拉普拉斯8邻边缘检测滤波器
func CreateEmbossFilterSymmetry ¶
func CreateEmbossFilterSymmetry(radius int, direction EmbossDirection, offset int) (filter FilterMatrix, err error)
CreateEmbossFilterSymmetry 创建对称浮雕滤波器
func CreateGaussBlurFilter ¶
func CreateGaussBlurFilter(radius int, sigma float64) (filter FilterMatrix, err error)
CreateGaussBlurFilter 创建高斯模糊滤波器 radius: 卷积核半径 [1,3] sigma: 标准差
func CreateMotionBlurFilter ¶
func CreateMotionBlurFilter(radius int, direction imagex.PixelDirection) (filter FilterMatrix, err error)
CreateMotionBlurFilter 创建运动模糊滤波器 radius: 卷积核半径 direction: 运动方向
func CreateSharpenFilter ¶
func CreateSharpenFilter(radius int, direction imagex.PixelDirection, diff uint) (filter FilterMatrix, err error)
CreateSharpenFilter 创建边锐化滤波器 radius: 卷积核半径 direction: 运动方向 diff: 梯度差
func CreateSharpenLaplace4Filter ¶
func CreateSharpenLaplace4Filter(radius int) (filter FilterMatrix, err error)
CreateSharpenLaplace4Filter 创建拉普拉斯4邻锐化滤波器
func CreateSharpenLaplace8Filter ¶
func CreateSharpenLaplace8Filter(radius int) (filter FilterMatrix, err error)
CreateSharpenLaplace8Filter 创建拉普拉斯8邻锐化滤波器
func (FilterMatrix) CheckValidity ¶
func (fm FilterMatrix) CheckValidity() error
CheckValidity 滤波模板有效性
func (FilterMatrix) IsPixelUnsafe ¶
func (fm FilterMatrix) IsPixelUnsafe() bool
IsPixelUnsafe 运算结果是否可能超出像素范围(非安全像素值)
func (FilterMatrix) IsScaleMatrix ¶
func (fm FilterMatrix) IsScaleMatrix() bool
IsScaleMatrix 是否为倍率滤波器
func (FilterMatrix) Rotate ¶
func (fm FilterMatrix) Rotate(clockwise bool, count90 int) FilterMatrix
Rotate 顺时针旋转90度
type KernelVector ¶
KernelVector 滤波器向量单元