SC
A Seam Carving algorithm implementation in Go with:
- CPU-only
- Uses all CPU cores in parallel
- Supports PNG, JPEG files
- Supports reduce image size
- Supports increase image size
- Supports region protection (imgMask green)
- Supports region erasure (imgMask red)
- Polish API
Usage
go get -u github.com/zrt/SC
import "github.com/zrt/SC"
Example
package main
import . "github.com/zrt/SC"
func main() {
img := LoadJPEG("input.jpg")
energyFunc := L2NormEnergyFunc
energyImg := SliceToImg(energyFunc(img, 1+2))
// show energy img
SavePNG(energyImg, "img_energy.png")
newImg, newImgSeam := Resize(img, energyFunc, 1280*8/10, 868*8/10, nil)
SavePNG(newImg, "output.png")
SavePNG(newImgSeam, "output_seam.png")
}
input.jpg
img_energy.png
output.png
output_seam.png
increase.png
increase_seam.png
Links
License
This project is licensed under GLWTPL.