Git Product home page Git Product logo

Comments (25)

venam avatar venam commented on June 14, 2024

Maybe we could use different color extractors.

from urnn.

neeasade avatar neeasade commented on June 14, 2024

Concur, but suggestions approaching this problem there as well? Repeat colors with highest frequency maybe? An alternative would be to figure a way to dynamically do node count, but it would probably be more work.

from urnn.

venam avatar venam commented on June 14, 2024

@jmbi wrote the go color extracter, maybe he could take a look at that as he has already done his study on the subject.

from urnn.

neeasade avatar neeasade commented on June 14, 2024

I have, the issue is still present there(not a fault of the program), only there's no option to print up to a specified number to extract. This makes sense in situations where there aren't x amount of colors to pull (targeting ten as that's the node number we've been associating).

My test input was this image from subtle patterns.

from urnn.

venam avatar venam commented on June 14, 2024

OK, when the colors script is executed on images that have less than 10 colors:

./colors -p -n 10 5zesg.png 
#eeeff0
#eff0f1
#f0f1f2
#f1f2f3
#f2f3f4
#f3f4f5
#f4f5f6

This happens and less than 10 colors are returned.
Maybe we could add a checking for the number of colors actually returned.

Namely extracter.pl should be checked:

    qx#
        ../colors/sin_colors/colors -en 10 $images[$i] |
        ../scripts/convert_hex_to_val_2.pl -s 1 > ../dataset/$nb.images.data
    #;

At the moment it's just doing some shell script magic.
Separating this into multiple steps plus checking will solve it.

from urnn.

neeasade avatar neeasade commented on June 14, 2024

from urnn.

venam avatar venam commented on June 14, 2024

Or we could use a random chosen color from the set.
I don't know how either of those will affect everything though.

We can test out the two options, that will need re-extracting the colors from the whole dataset.

from urnn.

neeasade avatar neeasade commented on June 14, 2024

Or we could use a random chosen color from the set.

True, the average colors thing was an attempt to negate favoring one color
over the other.

We can test out the two options, that will need re-extracting the colors
from the whole dataset.

Yeppyepp, this would have needed to happen anyway (In the current set,
pictures without ten colors to pull got the gap filled in with #000000
because that's sin_colors way of handling this).

Pretty sure we're on the same page about options here now, will proceed
experimenting this weekend unless you do first/whatever.

On Thu, May 19, 2016 at 10:32 AM, Patrick Louis [email protected]
wrote:

Or we could use a random chosen color from the set.
I don't know how either of those will affect everything though.

We can test out the two options, that will need re-extracting the colors
from the whole dataset.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#7 (comment)

Nathan Isom
Computer Science
Kansas State University

from urnn.

venam avatar venam commented on June 14, 2024

https://github.com/nixers-projects/urnn/blob/master/urnn#L78 and
https://github.com/nixers-projects/urnn/blob/master/urnn#L107 also need to take in consideration the case where there aren't 10 colors in the image passed.

Maybe we should write a simple script that handles that.
Only does that:

Takes colors and output 10 colors from them considering all the edge cases.

from urnn.

venam avatar venam commented on June 14, 2024

I updated convert_hex_to_val_2.pl to fill up the 10 colors when there are some missing.

I'm thinking that this doesn't make any sense if the colors aren't "ordered" in some way.
Otherwise there is no logic in the inputs.

What do you think?

from urnn.

neeasade avatar neeasade commented on June 14, 2024

I concur, but as opposed to picking random colors I would prefer to fill
the gap with a single color equal to the average of all colors pulled.

Thanks,
Nathan

On Wed, Jun 1, 2016 at 3:25 AM, Patrick Louis [email protected]
wrote:

I update convert_hex_to_val_2.pl to fill up the 10 colors when there are
some missing.

I'm thinking that this doesn't make any sense if the colors aren't
"ordered" in some way.
Otherwise there is no logic in the inputs.

What do you think?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#7 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADkuRMVe2sRsMZVAswGNXoAVcqB5UagKks5qHUILgaJpZM4IYDvh
.

from urnn.

venam avatar venam commented on June 14, 2024

I'm not that good with color theory.
What would an "average color" be?
Do you have an example?

from urnn.

neeasade avatar neeasade commented on June 14, 2024

I was just thinking mathematical average (There's probably a better color
theory way, but.)

So say we had a picture with 3 colors pulled:

#000000
#204020
#ffffff

These equate to:

RGB 0, 0, 0
RGB 0.078, 0.16, 0.078
RGB 1, 1, 1

So, we can average with:

R = (0 + 0.078 + 1)/3 = 0.36 * 255 = 5C
G = (0 + 0.16 + 1)/3 = 0.39 * 255 = 63
B = (0 + 0.078 + 1)/3 = 0.36 * 255 =5C

so the average of the colors is #5C635C.

Thanks,
Nathan

On Wed, Jun 1, 2016 at 11:32 PM, Patrick Louis [email protected]
wrote:

I'm not that good with color theory.
What would an "average color" be?
Do you have an example?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#7 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADkuRHM0NE-ZxdMuH2_U7OTCcQcWQmFoks5qHlzrgaJpZM4IYDvh
.

from urnn.

venam avatar venam commented on June 14, 2024

Yeah, this doesn't seem very accurate but we can try.

Let's see what some sample colors will have as complementary colors.

from urnn.

neeasade avatar neeasade commented on June 14, 2024

Leaving a link here for reference later:
http://stackoverflow.com/questions/398224/how-to-mix-colors-naturally-with-c

My goal with this is to neutralize any input beyond limited colors that may
come from a small image.

Thanks,
Nathan

On Tue, Jun 21, 2016 at 3:51 PM, Patrick Louis [email protected]
wrote:

Yeah, this doesn't seem very accurate but we can try.

Let's see what some sample colors will have as complementary colors.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#7 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADkuREVunq2oYYzTvmxar2-yFjAqt9ZMks5qOE7LgaJpZM4IYDvh
.

from urnn.

venam avatar venam commented on June 14, 2024

This seems very promising.
https://en.wikipedia.org/wiki/Lab_color_space

This is what we're gonna try implementing.

from urnn.

venam avatar venam commented on June 14, 2024

I committed some scripts to convert from one color space to another.

from urnn.

venam avatar venam commented on June 14, 2024

I tested with the scripts I wrote for the conversion.

Get the Lab value of the first two colors:
perl xyz_to_Lab.pl $(perl rgb_to_xyz.pl 255 192 203)
perl xyz_to_Lab.pl $(perl rgb_to_xyz.pl 35 168 109)

Calculate their midpoint and run the inverse:
perl xyz_to_rgb.pl $(perl Lab_to_xyz.pl 73.25521690710684 -12.34054291653397 9.779025080442)

HTML          RGB          L.a.b
#FFC0CB -> 255 192 203 -> 80.4714512772271 5.43488940769626 -3.8461673546804
#23A86D -> 35 168 109  -> 66.0389825369866 -30.1159752407642 23.4042175155644


Midpoint is ->  73.25521690710684 -12.34054291653397 9.779025080442
RGB -> 163 180 161, it is #A3B4A1

The visual output is here:
visual output midpoint
The third color is the Lab midpoint and the last one the RGB midpoint.

Now the question arise of which two colors we mix up?
Is it always the first two, then the second and third and so on?

from urnn.

neeasade avatar neeasade commented on June 14, 2024

Now the question arise of which two colors we mix up?

Yes, my impression was we would mix the colors pulled, and then use the result of that mixing for the rest of the empty slots (not continually mix)

from urnn.

venam avatar venam commented on June 14, 2024

I don't get it, you want to mix 5 colors together if we only have 5 colors.
Then we would have 6 colors, what do we do with the 4 others?
How would that even work?

from urnn.

neeasade avatar neeasade commented on June 14, 2024

In that example, we would mix the five colors. And then, use the result of that mixing as the value for the other five colors (give them all the same value).

from urnn.

venam avatar venam commented on June 14, 2024

I've ran a test.

The results are good.

This is my test image:
test image

It has 10 colors outputed by sin_color:

#14181b
#1f4a4e
#3b302a
#524337
#675948
#807159
#958d6f
#aea783
#cec295
#eed6a1

I took the first 6 and generated the average in the L.a.b colorspace.
Here's the result:
result
The last color is the average of the first 6.

As you can see, you were right, this color can be used to fill the missing ones.
My guess is that it's even more relevant when the image doesn't have 10 colors.

The drawback will be when it's an image that only has 2 colors that totally contrast one another.

Here are more details:

"""
Colors extracted from image: http://pub.iotek.org/p/w7xrjnR.png

#14181b
#1f4a4e
#3b302a
#524337
#675948
#807159
#958d6f
#aea783
#cec295
#eed6a1
"""

print (12.0954800164505+
35.6212096740741+
22.7833360286828+
30.7156518534006+
39.5385110802365+
48.4734500016107)/6.0


print (2.32079677956393 +
2.48100829455616 +
-4.11818111513351+
-7.67516056902925+
-10.1977056824407+
-13.6095909685789)/6.0


print (-1.63506117692257+
-1.75827840918759+
 3.00470067516956+
 5.66935083558926+
 7.56501833231841+
 10.1595992687907)/6.0

# perl xyz_to_rgb.pl $( perl Lab_to_xyz.pl 31.5379397757 -5.13313887684 3.83422158763)      <
#68 73 68
#   #444944
"""
Results: http://pub.iotek.org/p/qzS3wjX.png
"""

from urnn.

venam avatar venam commented on June 14, 2024

It's nice to fill the missing colors but the neural network presupposes that the inputs are always in the same order, from darker to lighter.
We have to reorder the colors after generating them.

from urnn.

venam avatar venam commented on June 14, 2024

I was also thinking, maybe we can feed the neural network Lab colors instead of RGB colors.

from urnn.

venam avatar venam commented on June 14, 2024

I wrote a script called fix_colors.pl it takes a number of colors as inputs and returns exactly 10 colors ordering them by hexadecimal value.
It does that by filling missing colors using the midpoint of the other colors in the Lab colorspace.
I didn't integrate it with the rest of the network.

The scripts to convert from one colorspace to another could be used to feed the network Lab colors instead of RGB but then we'll have to recalibrate the ranges so that we can map Lab to [-1,1].

from urnn.

Related Issues (5)

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.