Giter VIP home page Giter VIP logo

prominentcolor's People

Contributors

edlinorg avatar hekmon avatar icholy avatar jakekausler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

prominentcolor's Issues

Panic with completely black image

Hi,
I'm found a problem while i try to check dominant color on completely black image like the one below.

black

This is my code:

cols := prominentcolor.KmeansWithAll(3, img, prominentcolor.ArgumentNoCropping, 80, []prominentcolor.ColorBackgroundMask{})

col := cols[0].AsString()
fmt.Println("#"+col)

This is the output that i recive:

2018/01/21 16:31:05 Failed, k larger than len(allColors): 3 vs 0
panic: invalid argument to Intn

goroutine 1 [running]:
math/rand.(*Rand).Intn(0xc042072270, 0x0, 0x3)
	{GO_PATH}/src/math/rand/rand.go:142 +0xa3
math/rand.Intn(0x0, 0x0)
	{GO_PATH}/src/math/rand/rand.go:277 +0x3e
github.com/EdlinOrg/prominentcolor.kmeansPlusPlusSeed(0x3, 0x8, 0x614528, 0x0, 0x0, 0x0, 0x0, 0x0)
	{GO_PATH}/src/github.com/EdlinOrg/prominentcolor/kmeans.go:387 +0xd7
github.com/EdlinOrg/prominentcolor.kmeansSeed(0x3, 0x614528, 0x0, 0x0, 0x8, 0x0, 0xc0429de3c0, 0x5e3700)
	{GO_PATH}/src/github.com/EdlinOrg/prominentcolor/kmeans.go:357 +0x18e
github.com/EdlinOrg/prominentcolor.KmeansWithAll(0x3, 0x5e3700, 0xc0429de3c0, 0x8, 0x50, 0xc04296dec4, 0x3, 0x3, 0x501daa, 0xc042002020, ...)
	{GO_PATH}/src/github.com/EdlinOrg/prominentcolor/kmeans.go:111 +0x104
github.com/EdlinOrg/prominentcolor.KmeansWithArgs(0x8, 0x5e3700, 0xc0429de3c0, 0xc0429de3c0, 0x0, 0x0)
	{GO_PATH}/src/github.com/EdlinOrg/prominentcolor/kmeans.go:101 +0x104
main.main()
	{PROJECT_PATH}/main.go:38 +0x1d1

At the moment i moved to jakekausler/prominentcolor@7583347 a fork of this project that return errors instead of panic, so i can handle exceptions.

How can i have #000000 instead of panic?

v1.0

It would be great to get a v1 tagged release on this project :)

Mask Problem

The following image produce the incorrect result:

Failed, no non-alpha pixels found (either fully transparent image, or the ColorBackgroundMask removed all pixels)

resizeSize := uint(prominentcolor.DefaultSize)
bgmasks := []prominentcolor.ColorBackgroundMask{prominentcolor.MaskWhite}
colours, err := prominentcolor.KmeansWithAll(
		5, img, prominentcolor.ArgumentNoCropping|prominentcolor.ArgumentAverageMean|prominentcolor.ArgumentDebugImage,
		resizeSize, bgmasks)

test

I believe all single color images have the same problem

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.