Compare commits
3 Commits
b8546a4d57
...
main
Author | SHA1 | Date | |
---|---|---|---|
d1108be94b | |||
2e8ccce703 | |||
77843db6de |
@ -29,8 +29,8 @@ couple of hours (which I was honestly not expecting).
|
||||
|
||||
## Dependencies
|
||||
|
||||
- `go >= 1.21`
|
||||
- `ffmpeg` (optional, for video visualization, see [visualization methods](#visulazation-methods)
|
||||
- `go` >= 1.21
|
||||
- `ffmpeg` (optional, for video visualization, see [visualization methods](#visulazation-methods))
|
||||
|
||||
## Usage
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 6.3 MiB |
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 12 MiB |
Before Width: | Height: | Size: 16 MiB After Width: | Height: | Size: 11 MiB |
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 9.7 MiB |
@ -8,7 +8,6 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"sync"
|
||||
|
||||
"github.com/mazznoer/colorgrad"
|
||||
)
|
||||
@ -35,11 +34,8 @@ func (v *VideoVisualizer) Visualize(solved_chan <-chan *maze.SolvedMaze) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
var wg sync.WaitGroup
|
||||
i := 0
|
||||
for solved := range solved_chan {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
img_writer := writer.ImageWriter{
|
||||
Filename: path.Join(tmp_dir, fmt.Sprintf("%07v.png", i)),
|
||||
Maze: solved,
|
||||
@ -50,11 +46,8 @@ func (v *VideoVisualizer) Visualize(solved_chan <-chan *maze.SolvedMaze) {
|
||||
SolutionGradient: colorgrad.Warm(),
|
||||
}
|
||||
img_writer.Write()
|
||||
wg.Done()
|
||||
}()
|
||||
i++
|
||||
}
|
||||
wg.Wait()
|
||||
cmd := exec.Command(
|
||||
v.ffmpeg_cmd,
|
||||
"-y",
|
||||
|