Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func findCircle(window *Window, frame int) Circle {
- filtered := make(chan *image.Point, 1000)
- edge := make(chan image.Point, 100)
- transformed := make(chan Circle, 400)
- var c Circle
- var ok bool
- img,_ := getImage(window.Frames[frame].Path)
- fmt.Printf("Finding circle of %s\n", window.Frames[frame].Path)
- SetState(window, WORKING)
- redraw(*window, window.Frames[frame])
- start := time.Seconds()
- r := findBounds(&img)
- go filter(&img,filtered)
- go Sobel(&img,filtered,edge)
- go Transform(&img, edge, transformed, r)
- // var index int
- // bx,by := img.Bounds().Max.X,img.Bounds().Max.Y
- // votes := make([]int, bx*by*bx)
- // max := 0
- for {
- c,ok = <-transformed
- if ok != true {
- break
- }
- /* index = c.Radius+bx*c.Centre.Y+bx*by*c.Centre.X
- votes[index] += 1
- if votes[index] > max {
- max = votes[index]
- centre = c
- }*/
- }
- end := time.Seconds()
- fmt.Printf("Done in %d seconds\n", end-start)
- SetState(window, IDLE)
- return c
- }
Add Comment
Please, Sign In to add comment