Beispiel #1
0
func loadFeatureImage(file string, sbin int) (*rimg64.Multi, error) {
	f, err := loadRealImage(file)
	if err != nil {
		return nil, err
	}
	g := hog.HOG(f, hog.FGMRConfig(sbin))
	return g, nil
}
Beispiel #2
0
func evalImage(tmpl *detect.FeatTmpl, im image.Image, pyrStep float64, hogBin int, opts featpyr.DetectOpts) []detect.Det {
	// Construct image pyramid.
	scales := imgpyr.Scales(im.Bounds().Size(), tmpl.Size, pyrStep)
	pixpyr := imgpyr.New(im, scales)
	// Construct HOG pyramid.
	fn := func(rgb *rimg64.Multi) *rimg64.Multi { return hog.HOG(rgb, hog.FGMRConfig(hogBin)) }
	pyr := featpyr.New(pixpyr, fn, hogBin)
	// Search feature pyramid.
	dets := featpyr.Detect(pyr, tmpl, opts)
	return dets
}
Beispiel #3
0
func loadFeatImage(fname string, sbin int) (*rimg64.Multi, error) {
	file, err := os.Open(fname)
	if err != nil {
		return nil, err
	}
	defer file.Close()

	im, _, err := image.Decode(file)
	if err != nil {
		return nil, err
	}
	return hog.HOG(rimg64.FromColor(im), hog.FGMRConfig(sbin)), nil
}
Beispiel #4
0
// Returns HOG image of a visual image.
func hogImage(img image.Image, binSize int) cv.RealVectorImage {
	return hog.HOG(cv.ColorImageToReal(img), binSize)
}