Skip to content

Commit

Permalink
create frame copy - SubImage shares pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-m committed Nov 23, 2023
1 parent 986d22a commit 03bcf15
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/trainbot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ func detectTrainsForever(c config, trainsOut chan<- *stitch.Train) {
if err != nil {
log.Panic().Err(err).Msg("failed to crop frame")
}

// Create a new image with only the cropped pixels,
// so we can gc the potentially large area from the
// original image.
cropped = imutil.Copy(cropped)
}

if cropped.Bounds().Size() != rect.Size() {
Expand Down

0 comments on commit 03bcf15

Please sign in to comment.