Esempio n. 1
0
File: vis.go Progetto: jvlmdr/go-cv
func drawCell(feat *rimg64.Multi, i, j int, gc *draw2d.ImageGraphicContext, cell int) {
	u := (float64(i) + 0.5) * float64(cell)
	v := (float64(j) + 0.5) * float64(cell)
	r := float64(cell) / 2

	for k := 0; k < Orientations; k++ {
		x := feat.At(i, j, k)
		x = math.Max(x, 0)
		x = math.Min(x, 1)
		gc.SetStrokeColor(color.Gray{uint8(x*254 + 1)})
		theta := (0.5 + float64(k)/float64(Orientations)) * math.Pi
		drawOrientedLine(gc, u, v, theta, r)
	}
}
Esempio n. 2
0
File: vis.go Progetto: jvlmdr/go-cv
func drawOrientedLine(gc *draw2d.ImageGraphicContext, x, y float64, theta float64, r float64) {
	c := math.Cos(theta)
	s := math.Sin(theta)
	gc.MoveTo(x-r*c, y-r*s)
	gc.LineTo(x+r*c, y+r*s)
	gc.Stroke()
}
Esempio n. 3
0
func DrawCircle(gc *draw2d.ImageGraphicContext, x, y float64) {
	gc.ArcTo(x, y, 3, 3, 0, 2*math.Pi)
	gc.SetFillColor(color.RGBA{255, 0, 0, 255})
	gc.FillStroke()
}
Esempio n. 4
0
func DrawLine(gc *draw2d.ImageGraphicContext, x1, y1, x2, y2 float64) {
	gc.MoveTo(x1, y1)
	gc.LineTo(x2, y2)
	gc.FillStroke()
}
Esempio n. 5
0
func WhiteBG(gc *draw2d.ImageGraphicContext, xsize, ysize float64) {
	gc.BeginPath()
	gc.MoveTo(0, 0)
	gc.LineTo(xsize, 0)
	gc.LineTo(xsize, ysize)
	gc.LineTo(0, ysize)
	gc.LineTo(0, 0)
	gc.Close()
	gc.SetFillColor(color.RGBA{255, 255, 255, 0xff})
	gc.Fill()

}