-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqr_test.go
53 lines (40 loc) · 993 Bytes
/
qr_test.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 qrpie
import (
"fmt"
_ "image/png"
"image"
"math/rand"
"os"
"testing"
)
var qr = NewQr("model.csv")
func TestIsSim(t *testing.T) {
fmt.Println(isSim(45, 9*3))
}
func TestGenerateTrainData(t *testing.T) {
GenerateTrainData("/Users/coyte/Downloads/erweima", "/Users/coyte/Downloads/img", "train_data.csv")
}
func TestIsQr(t *testing.T) {
}
func TestDownLoadImg(t *testing.T) {
downLoadImg("http://www.yigeshaozi.com/qiniu/5599/image/fbc36af155da17d17d512ea25b4ca874.png?imageView2/2/w/399")
}
func TestIsQrUrl(t *testing.T) {
fmt.Println(qr.IsQrUrl("outPG/Art/view_formula_2x.png"))
}
func TestIsQrPath(t *testing.T) {
for {
fmt.Println(rand.Intn(2))
}
}
func TestFeatures(t *testing.T) {
qr := NewQr("model.csv")
file, _ := os.Open("view_formula_2x.png")
img, _, _ := image.Decode(file)
fmt.Println(qr.IsQr(img))
}
func TestGrayMean(t *testing.T) {
file, _ := os.Open("view_formula_2x.png")
img, _, _ := image.Decode(file)
fmt.Println(grayMean(img))
}