Documentation ¶
Overview ¶
Package stitch allows stitching a sequence of image frames of a linearly (as in direction) moving object into an image of the entire object.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoStitcher ¶
type AutoStitcher struct {
// contains filtered or unexported fields
}
AutoStitcher is an automatic train detector and stitcher. Use NewAutoStitcher() to create an instance.
func NewAutoStitcher ¶
func NewAutoStitcher(c Config) *AutoStitcher
NewAutoStitcher creates a new AutoStitcher.
func (*AutoStitcher) Frame ¶
Frame adds a frame to the AutoStitcher. Takes ownership of the image data buffer, so be sure to make a copy before passing it.
func (*AutoStitcher) TryStitchAndReset ¶
func (r *AutoStitcher) TryStitchAndReset() *Train
TryStitchAndReset tries to stitch any remaining frames and resets the sequence.
type Config ¶
type Config struct { PixelsPerM float64 MinSpeedKPH float64 MaxSpeedKPH float64 MinLengthM float64 MaxFrameCountPerSeq int }
Config is the configuration for a AutoStitcher. All values must be > 0, except for MinSpeedKPH which might also be 0.
type Train ¶
type Train struct { StartTS time.Time // Always positive. NFrames int // Always positive (absolute value). LengthPx float64 // Positive sign means movement to the right, negative to the left. SpeedPxS float64 // Positive sign means increasing speed for trains going to the right, breaking for trains going to the left. AccelPxS2 float64 Conf Config Image *image.RGBA `json:"-"` GIF *gif.GIF `json:"-"` }
Train represents a detected train.
func (*Train) AccelMpS2 ¶
AccelMpS2 returns the acceleration in m/2^2, corrected for speed direction: Positive means accelerating, negative means breaking.
func (*Train) DirectionS ¶
DirectionS returns the train direction as string "left" or "right".