Beispiel #1
0
// Creates a padded rectangle whose interior is size with the given margin.
func Pad(size image.Point, m feat.Margin) PadRect {
	return PadRect{
		Size: image.Pt(size.X+m.Left+m.Right, size.Y+m.Top+m.Bottom),
		Int:  image.Rectangle{Max: size}.Add(m.TopLeft()),
	}
}
Beispiel #2
0
// Converts the position of a detection in a feature image to a rectangle in the intensity image.
//
// Additional arguments are:
// the integer downsample rate of the feature transform,
// the margin which was added to the image before taking the feature transform,
// the rectangular region within the window which corresponds to the annotation.
func featPtToImRect(pt image.Point, rate int, margin feat.Margin, interior image.Rectangle) image.Rectangle {
	return interior.Add(pt.Mul(rate)).Sub(margin.TopLeft())
}