-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
53 lines (45 loc) · 1.52 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"fmt"
progress "go-image-processing/in-progress"
"go-image-processing/utilities"
"math"
"time"
)
var FORMAT string
func main() {
path := "images/15.jpeg"
img, f, openMS, convertMS := utilities.OpenFile(path)
FORMAT = f
now := math.Round(float64(time.Now().UnixNano()) / 1000000)
bilateral := progress.Bilateral(img, 3, 10, 15)
processMS := int(math.Round(float64(time.Now().UnixNano())/1000000) - now)
name := fmt.Sprintf(`file-%d.%s`, time.Now().Unix(), FORMAT)
saveMS := utilities.SaveFile("bilateral-"+name, FORMAT, bilateral)
/* Optimized filters */
// filters.Binary(path, 122)
// filters.BoxBlur(path, 10)
// filters.Brightness(path, 256)
// filters.Contrast(path, 205)
// filters.EightColors(path)
// filters.Emboss(path)
// filters.Flip(path, constants.FLIP_TYPE_HORIZONTAL)
// filters.GammaCorrection(path, 0.1)
// filters.GaussianBlur(path, 5.2)
// filters.Grayscale(path, constants.GRAYSCALE_TYPE_LUMINANCE)
// filters.HueRotate(path, 252)
// filters.Invert(path)
// filters.Kuwahara(path, 4)
// filters.Laplacian(path)
// filters.RotateFixed(path, constants.ROTATE_FIXED_90)
// filters.Sepia(path)
// filters.Sharpen(path, 92)
// filters.Sobel(path)
// filters.Solarize(path, 100)
/* Alternative implementations */
// progress.BinaryCH(path, 122)
// progress.GaussianBlurCH(path, 10.0)
// progress.GaussianBlurCHSlow(path, 10.0)
sum := openMS + convertMS + processMS + saveMS
println("s open", openMS, "convert", convertMS, "process", processMS, "save", saveMS, "sum", sum)
}