Exemplo n.º 1
0
// DetectImage computes features and then calls Detect.
func DetectImage(im image.Image, phi feat.Image, pad feat.Pad, scorer slide.Scorer, shape PadRect, detopts DetFilter, suppropts SupprFilter) ([]Det, error) {
	f, err := feat.ApplyPad(phi, im, pad)
	if err != nil {
		return nil, err
	}
	return Detect(f, pad.Margin, phi.Rate(), scorer, shape, detopts, suppropts)
}
Exemplo n.º 2
0
Arquivo: pyr.go Projeto: jvlmdr/go-cv
// Constructs a feature pyramid.
// Extends each level by a margin before computing features.
func NewPad(images *imgpyr.Pyramid, phi feat.Image, pad feat.Pad) (*Pyramid, error) {
	feats := make([]*rimg64.Multi, len(images.Levels))
	for i, im := range images.Levels {
		var err error
		f, err := feat.ApplyPad(phi, im, pad)
		if err != nil {
			return nil, err
		}
		feats[i] = f
	}
	log.Print("finished computing feature transform: ", len(images.Levels))
	return &Pyramid{images, feats, phi.Rate(), pad.Margin}, nil
}
Exemplo n.º 3
0
Arquivo: gen.go Projeto: jvlmdr/go-cv
func (pyr *Generator) Next(curr *Level) (*Level, error) {
	t := time.Now()
	im := pyr.Image.Next(curr.Image)
	pyr.DurResize += time.Since(t)
	if im == nil {
		return nil, nil
	}
	t = time.Now()
	x, err := feat.ApplyPad(pyr.Transform, im.Image, pyr.Pad)
	pyr.DurFeat += time.Since(t)
	if err != nil {
		return nil, err
	}
	return &Level{im, x}, nil
}