Beispiel #1
0
func (m *Mosaic) FillDescriptions(targetImage image.Image,
	bounds image.Rectangle, builder descriptors.DescriptionBuilder) {
	for i := range m.Descriptions {
		description, err := builder.GetDescription(targetImage, m.Grid[i])
		if err != nil {
			fmt.Println("can't create description for tile")
		}
		m.Descriptions[i] = description
		m.MatchScores[i] = math.MaxFloat64
	}
}
Beispiel #2
0
func GetTile(b descriptors.DescriptionBuilder, url string) (Tile, error) {
	var t Tile
	t.Url = url

	m, err := fetcher.GetImage(url)
	if err != nil {
		return t, err
	}

	t.Description, err = b.GetDescription(m, m.Bounds())
	if err != nil {
		return t, err
	}

	return t, nil
}