Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mukarillo/unityprominentcolor
Tool to gather main colors of an image using Unity.
https://github.com/mukarillo/unityprominentcolor
image-classification image-processing image-recognition unity unity3d unity3d-plugin
Last synced: 3 months ago
JSON representation
Tool to gather main colors of an image using Unity.
- Host: GitHub
- URL: https://github.com/mukarillo/unityprominentcolor
- Owner: Mukarillo
- License: mit
- Created: 2018-05-01T23:43:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-10T15:20:22.000Z (over 3 years ago)
- Last Synced: 2024-10-11T10:14:14.878Z (3 months ago)
- Topics: image-classification, image-processing, image-recognition, unity, unity3d, unity3d-plugin
- Language: C#
- Size: 340 KB
- Stars: 54
- Watchers: 7
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Unity Prominent Color
This is a very simple tool to gather main colors of an image using Unity.## How to use
You will find a static class called ProminentColor. You can call **GetColors32FromImage** to get a `List` or **GetHexColorsFromImage** to get a `List` (of hex colors). Both of the methods will take these parameters:|name |type |description |
|--|--|--|
|`texture` |**Texture2D** |*Texture to get colors* |
|`maxColorAmount` |**int** |*The max length of the list to be returned* |
|`colorLimiterPercentage` |**float** |*Value used to compare color amounts. If color amount percentage is less than this value, it will not be marked as valid color* |
|`toleranceUniteColors` |**int** |*Value used to compare colors and unite them if is a match, useful to discard gradients* |
|`minimiumColorPercentage` |**float** |*Value used to remove colors that have lower amount percentage compared with full image* |![result image](https://github.com/Mukarillo/UnityProminentColor/blob/master/result.png?raw=true)
*simple result, without much fine tunning*## Removing the white (or any color) border
If your image has borders, you will probably have this color in the list. If you wish to remove this border, there is a helper in ProminentColor class called **RemoveBorder**, it returns the `Texture2D` without the border. This method take these parameters:|name |type |description |
|--|--|--|
|`texture` |**Texture2D** |*Texture to remove the border* |
|`compareColor` |**Color32** |*Color to be removed* |
|`tolerance` |**float** |*Tolerance to compare the color to be removed* |![removing borders](https://github.com/Mukarillo/UnityProminentColor/blob/master/remove_border.png?raw=true)
*as you can see, there are small glitches, but white is not prominent anymore.*