iOS开源:iOSPalette-图片精确提取主色调算法

算法 iOS开发   2017-06-09 08:55:12 发布
您的评价:
     
0.0
收藏     0收藏
文件夹
标签
(多个标签用逗号分隔)

1.介绍

Objective-C版本的Google Palette算法在Java.A工具中提取了一个图像的主要颜色。与传统的算法相比,iOSPalette可以帮助您提取更有可能成为“主色”的主色。它不是 总是像素数中最大的。

 

2.Why iOS-Palette

1.It always help you to extract the color you want,no the largest in the pixel count.Just like this case:

You can see the 6 TargetMode from the demo screenshot.They are distinguished by different Saturation and Lightness (According to HSL Color Mode).

LIGHT_VIBRANT_MODE (High Lightness , High Saturation)

VIBRANT_MODE(Normal Lightness , High Saturation)

DARK_VIBRANT_MODE(Dark Lightness , High Saturation)

LIGHT_MUTED_MODE(High Lightness , Low Saturation)

MUTED_MODE(Normal Lightness , Low Saturation)

DARK_MUTED_MODE(Dark Lightness , Low Saturation)

You can get every target mode color thourgh the iOSPalette API if you need!

2.It helps to combine every single RGB Value into a VBox,then calculate the most representational color.

3.How to use iOS-Palette

You can get these simple API in Palette.h and UIImage+Palette.h:

If you need all target mode info, you can use these API in Palette.h and UIImage.Palette.h:

Then you all get the callback with all color infomation you want:

Tips:The recommendColor is the color for the vibrant target.In case of null,It will be replaced by this order:MUTE_MODE------LIGHT_VIRANT_MODE ------LIGHT_MUTE_MODE------DARK_VIBRANT_MODE------DARK_MUTE_MODE.

Absolutely,you can change the order if you want different performance.

4.Demo

1.Before white background:

2.In the normal illumination:

5.Contact me

if you have any question,you can contact me thourgh the contact infomation below.Or open a issue on Github.I will solve it as soon as possible!Best wishes!

项目主页:http://www.open-open.com/lib/view/home/1496969712318

 

 

 

扩展阅读

开源 iOS 项目分类索引大全
一些优秀的 iOS 博客和文章集合
个人学习iOS开发-阅读收集的资料
iOS开发者必备:自己总结的iOS、mac开源项目及库
iOS开发-图片高斯模糊效果

为您推荐

基于fis的前端模块化和工程化方案
Google Dremel 原理 - 如何能3秒分析1PB
nginx+tomcat+memcached负载均衡集群搭建详细笔记(上)
VMware10.0安装Mac OS X 10.9超详细教程
Android ImageView图片自适应

更多

算法
iOS开发
相关文档  — 更多
相关经验  — 更多
相关讨论  — 更多