Exemple #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)
}
Exemple #2
0
// 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
}
Exemple #3
0
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
}