// 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) }
// 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 }