Giter Site home page Giter Site logo

sc's Introduction

SC

GoDoc Go Report Card License

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

example

img_energy.png

example

output.png

example

output_seam.png

example

increase.png

example

increase_seam.png

example

Links

License

This project is licensed under GLWTPL.

sc's People

Contributors

zrt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.