Coder Social home page Coder Social logo

detectimagecolors's Introduction

Detect Image Colors

Extracts 4 main colors from an image: primary, secondary, detail and background.

Code Usage

Swift version: 2.0

  1. Grab the files which name begins with "CD" and copy them to your Xcode Swift project.

  2. Optional: tweak CDSettings variables

  3. Create color candidates from image:

let colorCandidates = image.getColorCandidates()

Demo Application

Compile with Xcode 7.0.1+

DetectImageColors demo app

Download or clone the project, open in Xcode, build.

You can drop a new image on the image view and tweak the sliders to find values you like for the thresholds and ratios.

Playground

A Playground is also included for demo purposes.

Playground

Todo

Suggestions and contributions are welcomed!

  • Improve detector accuracy (see comments in CDColorDetector.swift)

  • Improve resize image method

  • Make a better demo app

  • Make a framework

  • Make it iOS compatible

History

This started has a translation from Objective-C to Swift of Color Art by Panic Software, from their 2011 blog article.

Then after lots of changes and optimizations (and a few regressions) I added new features like color names and customizable parameters.

I've also made a simple demo app to test the color detection.

Disclaimer

This is a programming exercise. I'm not trying to replace Color Art or to mimic Apple's iTunes, but to build upon the idea and progressively create something different.

Licence

MIT but you have to refer to Panic's repository somewhere visible.

detectimagecolors's People

Contributors

ericdke avatar

Watchers

 avatar  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.