Documentation ¶
Index ¶
- func Abs(x int) uint32
- func Filter(img image.Image, flt FilterType) *image.Gray
- func FilterGray(grayImg *image.Gray, flt FilterType) (filtered *image.Gray)
- func FilterGrayFast(grayImg *image.Gray, flt FilterType) (filtered *image.Gray)
- func FilterGrayMath(grayImg *image.Gray) (filtered *image.Gray)
- func FilterGraySimd(grayImg *image.Gray) (filtered *image.Gray)
- func FilterMath(img image.Image, flt FilterType) *image.Gray
- func FilterSimd(img image.Image, flt FilterType) *image.Gray
- func FloorSqrt(x uint32) (ans uint32)
- func FloorSqrtFast(x uint32) (ans uint32)
- func ISqrt(n uint32) (x uint32)
- func ToGrayscale(img image.Image) *image.Gray
- type FilterType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterGray ¶
func FilterGray(grayImg *image.Gray, flt FilterType) (filtered *image.Gray)
for better optimization in case of input gray image
func FilterGrayFast ¶
func FilterGrayFast(grayImg *image.Gray, flt FilterType) (filtered *image.Gray)
Benchmark_FilterGray 27336411 ns/op Benchmark_FilterGrayFast 19521755 ns/op for better optimization in case of input gray image
func FilterGraySimd ¶
BenchmarkIT/Benchmark_FilterGraySimd-2 1032 1499811 ns/op malloc
BenchmarkIT/Benchmark_FilterGraySimd-2 501 2000184 ns/op dstX := make([]uint16, dstSize) dstXC := (*C.uint8_t)(unsafe.Pointer(&dstX[0]))
BenchmarkIT/Benchmark_FilterGraySimd-2 276 4853208 ns/op add flited filling
func FilterMath ¶
func FilterMath(img image.Image, flt FilterType) *image.Gray
func FilterSimd ¶
func FilterSimd(img image.Image, flt FilterType) *image.Gray
func FloorSqrt ¶
https://www.geeksforgeeks.org/square-root-of-an-integer/ Time Complexity: O(Log x)
func FloorSqrtFast ¶
func ISqrt ¶
ISqrt returns floor(sqrt(n)). Typical run time is few hundreds of ns. https://gitlab.com/cznic/mathutil/-/blob/master/mathutil.go
Types ¶
type FilterType ¶
type FilterType int
const ( Sobel FilterType = iota SobelFast Laplasian Shara Sharpen )