Edit your config.toml while the app is running and watch the pipeline update instantly. No recompiling. No stopping the camera. Pure iteration bliss.
Why This Matters
If you've ever prototyped with raw GoCV (or any OpenCV binding), you know the pain:
- Change a threshold or kernel size? Edit code → recompile → restart → wait for camera init.
- Takes 10-30 seconds per tweak → kills your flow.
- Accidentally leak a Mat? Crash and start over.
GoCVKit fixes this with live config hot-reload. Save config.toml → the running app detects the change → rebuilds the entire pipeline on the fly → you see the result immediately.
It's the closest thing Go has to Jupyter notebooks for computer vision.
How It Works (The Magic Explained)
Under the hood it's simple and robust:
- A lightweight file watcher (using
fsnotify) monitorsconfig.toml. - On any save, the config is re-parsed.
- The pipeline builder recreates all processors with new parameters.
- The next frame uses the brand-new pipeline – no frames dropped, no allocations outside the double buffer.
Zero boilerplate for you. Zero leaks guaranteed.
Hands-On: See It Yourself
Fire up the quick start if you haven't already:
mkdir gocvkit-demo && cd gocvkit-demo
go mod init demo
go get github.com/Elliot727/gocvkit
main.go
package main
import (
"log"
"github.com/Elliot727/gocvkit"
)
func main() {
app, err := gocvkit.NewApp("config.toml")
if err != nil {
log.Fatal(err)
}
defer app.Close()
app.Run(nil)
}
Create initial config
config.toml
[app]
window_name = "GoCVKit – Hot-Reload Demo"
[[pipeline.steps]]
name = "Grayscale"
[[pipeline.steps]]
name = "Canny"
low = 50
high = 150
Now the fun part:
- Window opens showing live Canny edges.
- Open
config.tomlin your editor. - Change
high = 150→high = 300→ save. → Edges instantly thicken. - Replace the entire Canny block with GaussianBlur:
[[pipeline.steps]]
name = "GaussianBlur"
kernel = 15
sigma = 3
Save → blur appears instantly.
- Try something wild:
[[pipeline.steps]]
name = "Grayscale"
[[pipeline.steps]]
name = "MedianBlur"
k = 21
No restarts. No code changes. Just pure experimentation.
Pro Tips for Hot-Reload Happiness
- Typos? GoCVKit prints clear errors in the terminal but keeps the old pipeline running – no crash.
- Add/remove steps freely – the builder handles it gracefully.
- Want to test recording too? Flip
record = truelive and it starts/stops without hassle.
The pipeline itself uses double-buffering so frame processing never blocks or allocates per frame. That's why you get smooth FPS even during reloads.
Try It Yourself
Grab the repo, run the example above, and go wild with the config. Break it on purpose – you'll see how forgiving it is.
What's the first parameter you always tweak in edge detection? Thresholds? Kernel sizes? Tell me in the comments!
Top comments (0)