Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGB version? #3

Open
ofou opened this issue Aug 4, 2019 · 108 comments
Open

RGB version? #3

ofou opened this issue Aug 4, 2019 · 108 comments

Comments

@ofou
Copy link

ofou commented Aug 4, 2019

I was wondering if it's possible to make a RGB version of this algorithm using 3 threads instead of one. It would be amazing if this is possible. Have you thought about it?

@i-make-robots
Copy link
Collaborator

i-make-robots commented Aug 4, 2019 via email

@whitecherep
Copy link

Is it possible to make not just Red Green Blue version, but colorful (depends how many colors picture require or you set for example 3-5 colors in settings)? In order to receive something like this
https://www.youtube.com/watch?v=J7bALdSkPow
https://www.youtube.com/watch?v=i8N4TmOMTLA
https://www.youtube.com/watch?v=r3_dS1gvYLU
https://www.youtube.com/watch?v=iv_x1uJDvO8

@i-make-robots
Copy link
Collaborator

i-make-robots commented Aug 9, 2019 via email

@whitecherep
Copy link

maybe before scan an image you can choose (or change in code) something like modes: fast(3 colors), medium(4 colors), exact(5 colors) or just simply set number of colors in code "colors: 3" or "colors: 5", etc. And when program scans the image it chooses main 3-4-5 colors(depending to what number you set in code) of the image you need in order to replicate the picture in choosen quality.

@i-make-robots
Copy link
Collaborator

i-make-robots commented Aug 9, 2019 via email

@whitecherep
Copy link

hm.. not sure about this) maybe you already have something in mind?

@i-make-robots
Copy link
Collaborator

i-make-robots commented Aug 30, 2019 via email

@i-make-robots
Copy link
Collaborator

i-make-robots commented Aug 30, 2019 via email

@whitecherep
Copy link

I found some other code on github but can't get it work/install the script as I am not familiar with programming, but maybe this code will help you to figure out how is it possible to make it in your script?
https://github.com/MaloDrougard/knit
https://github.com/MaloDrougard/knit/wiki/Installation-of-openframework-qtcreator-knitApp

@i-make-robots
Copy link
Collaborator

i-make-robots commented Aug 30, 2019 via email

@i-make-robots
Copy link
Collaborator

i-make-robots commented Aug 31, 2019 via email

@whitecherep
Copy link

Nice work. I have found that she uses max 8000 lines. Here is a result on 8000 lines by your algorithm (she used black, white, yellow, green and red).
One thing is maybe that she uses grey/coffee color canvas so it helps and add one more color close to skin color but I am not sure it helps at all.
another thing I guess thier algorithm may work like layer after layer. For example you knit some lines in black color then some pack of lines by red, then pack/layer with yellow, then again layer of black, etc
but not like different color lines everytime line by line because in this case whole picture will take a lot of time, not just a few of days.
mona_preview
изображение

@i-make-robots
Copy link
Collaborator

i-make-robots commented Sep 2, 2019 via email

@whitecherep
Copy link

whitecherep commented Sep 2, 2019

seems you have updated black/white algorithm to colors too?
Here is (3rd from the left) a version by that algorithm (maybe even better?)
изображение
image

@fanqieo
Copy link

fanqieo commented Sep 6, 2019

I like your program very much
Let's say I set 30,000 lines and I only execute 2,000 lines and I'm done
weaving_algorithm_circle

@i-make-robots
Copy link
Collaborator

i-make-robots commented Sep 6, 2019 via email

@i-make-robots
Copy link
Collaborator

i-make-robots commented Sep 6, 2019 via email

@fanqieo
Copy link

fanqieo commented Sep 6, 2019

Will the program continue to adjust? Look forward to.

@Neyestan
Copy link

Hi,
I have made one of these (one string color) for my daughter. I used 256 nails, 4000 lines and 3046 meters of thread and it took me 53 hours to finish it..
I am very much interested to make one in color but definitely not in 30000 lines.
IMG_2809
IMG_2933
1200 lines - 2
1600 lines - 2
2200 lines - 2
3000 lines - 1
4000 lines

@i-make-robots
Copy link
Collaborator

i-make-robots commented Nov 29, 2019 via email

@Neyestan
Copy link

Neyestan commented Nov 29, 2019

Yes of course you can.

@Neyestan
Copy link

Where is your blog?

@i-make-robots
Copy link
Collaborator

i-make-robots commented Nov 30, 2019 via email

@i-make-robots
Copy link
Collaborator

i-make-robots commented Nov 30, 2019 via email

@i-make-robots
Copy link
Collaborator

@GalacticJellyfish
Copy link

GalacticJellyfish commented Dec 4, 2019

@Neyestan that looks absolutely gorgeous! Well done!

@geekality
Copy link

@Neyestan That looks great, looks like it requires a lot of patience!

@amirahar
Copy link

amirahar commented Feb 6, 2020

Hi
Your work is great
I just want some advice from you
Can I work in square or rectangle (black and white)
Also in the folder below
weaving_algorithm_square
I don't run the program when I change the photo

  • Excuse me I don't speak English and wrote with Google Transylite

@Neyestan
Copy link

Neyestan commented Feb 6, 2020 via email

@i-make-robots
Copy link
Collaborator

i-make-robots commented Feb 6, 2020 via email

@polemos0108
Copy link

hi there. i started make another picture. it's vincent.
116870595_2592795601032127_4414636916921106213_o

@i-make-robots
Copy link
Collaborator

i-make-robots commented Aug 14, 2020 via email

@fanqieo
Copy link

fanqieo commented Aug 15, 2020

hi there. i started make another picture. it's vincent.
116870595_2592795601032127_4414636916921106213_o

Hello, can you provide your code?

@Neyestan
Copy link

Hello Dan,
Did you see those two links?

@polemos0108
Copy link

Nice. I think this script needs to work with images 10x bigger to get more detail with finer thread.

On Fri, Aug 14, 2020 at 9:27 AM polemos0108 @.***> wrote: hi there. i started make another picture. it's vincent. [image: 116870595_2592795601032127_4414636916921106213_o] https://user-images.githubusercontent.com/56480365/90271230-85bfdf80-de6c-11ea-8418-754819196023.jpg — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#3 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALFRBUMIMTPI6BCH7FX2MDSAVQYTANCNFSM4IJGABXA .
-- Dan Royer Owner ------------------------------ 1 (604) 259 9564 <16042599564> dan@marginallyclever.com www.marginallyclever.com https://www.facebook.com/MarginallyClever/ https://www.instagram.com/imakerobots/ https://www.youtube.com/channel/UCfbRxqjuOgE2EzRKxcePArw https://twitter.com/MarginallyC https://github.com/MarginallyClever/

if i use bigger image i need more strings. it's hard to make more strings physical.

@i-make-robots
Copy link
Collaborator

Agreed!

@sanad-lol
Copy link

sanad-lol commented Sep 29, 2020

here is a hint i noticed but i dont know i f it helps or no!
before i get to know your great work here i used this code to make some portraits. (https://github.com/christiansiegel/knitter)
he used a grey scale image to generate the pattern or the steps.
i am not expert put i know that rgb model is not suitable for this project as you mentioned.. instead you used cmyk.
i understood that differance between rgb and cmyk kinda of corelated to the brighttness thing.so
i compared the numbers you generte in color model..to those in grey scale model ..maybe i will find repeated lines!
So the line to choose is the line optained from gray scale model "which represent brightness" and its color is optained from your color model both of the same image.
i didnt find a lot of similer lines but it was so colse!
just saying and maybe this hint to you some thing!
thanks anyway for your efforts<3

@sanad-lol
Copy link

sanad-lol commented Oct 2, 2020

hi! it,s me again. but with something more useful this time.
i have done more work on the graphic design side of things and i hope you consider it..
there is a select option in photo shop called color range that select similar colors in the photo and turn the photo into clusters like folows:
the red color range
red
the black color range
black
the brwon color range
brown
the green
green
all togeather
all colors
.......
in the coding side of things do you think all of that may come togeather
i mean instead of using red ,green ,blue, yellow thread
we use red brown green and black thread on white background using the photos obtained from photoshop?

@i-make-robots
Copy link
Collaborator

i-make-robots commented Oct 2, 2020 via email

@sanad-lol
Copy link

sanad-lol commented Oct 2, 2020

i used the instruction file from each as input and the result is away far 👎
maybe the threads need to be in a layers style .. how much thread in a layer or what layer above the other i cant figure it out
Annotation 2020-10-02 222952
in total it takes 7000 thread.. which is a good thing in the other hand

@i-make-robots
Copy link
Collaborator

i-make-robots commented Oct 2, 2020 via email

@arun-sagar
Copy link
Collaborator

Nice! What inspired you? How many strings & nails is that? What is the diameter of the circle? How long did it take? Can I share that on my blog?

On Tue, May 26, 2020 at 1:07 PM polemos0108 @.***> wrote: [image: IMG_20200526_154525] https://user-images.githubusercontent.com/56480365/82945398-e5b19300-9fad-11ea-9f1f-9edd94ed75b1.jpg I did it. Thank you for code — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#3 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALFRBQRH3FHX4WVXSOYLT3RTQOPPANCNFSM4IJGABXA .
-- Dan Royer Owner ------------------------------ 1 (604) 259 9564 <16042599564> dan@marginallyclever.com www.marginallyclever.com https://www.facebook.com/MarginallyClever/ https://www.instagram.com/imakerobots/ https://www.youtube.com/channel/UCfbRxqjuOgE2EzRKxcePArw https://twitter.com/MarginallyC https://github.com/MarginallyClever/

this is a girl with pearl earning. painting by johannes Vermeer.

210 points. 8000 lines.
Diameter of circle 70 cm.
I made it in 2 month.
If you want share it I will add more picrures
IMG_20200526_154449
IMG_20200526_154501
IMG_20200526_154514
IMG_20200526_160724
IMG_20200526_154532

Hi
I guess if you use thin thread the result might look much better or increase the canvas size

@polemos0108
Copy link

Nice! What inspired you? How many strings & nails is that? What is the diameter of the circle? How long did it take? Can I share that on my blog?

On Tue, May 26, 2020 at 1:07 PM polemos0108 @.***> wrote: [image: IMG_20200526_154525] https://user-images.githubusercontent.com/56480365/82945398-e5b19300-9fad-11ea-9f1f-9edd94ed75b1.jpg I did it. Thank you for code — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#3 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALFRBQRH3FHX4WVXSOYLT3RTQOPPANCNFSM4IJGABXA .
-- Dan Royer Owner ------------------------------ 1 (604) 259 9564 <16042599564> dan@marginallyclever.com www.marginallyclever.com https://www.facebook.com/MarginallyClever/ https://www.instagram.com/imakerobots/ https://www.youtube.com/channel/UCfbRxqjuOgE2EzRKxcePArw https://twitter.com/MarginallyC https://github.com/MarginallyClever/

this is a girl with pearl earning. painting by johannes Vermeer.
210 points. 8000 lines.
Diameter of circle 70 cm.
I made it in 2 month.
If you want share it I will add more picrures
IMG_20200526_154449
IMG_20200526_154501
IMG_20200526_154514
IMG_20200526_160724
IMG_20200526_154532

Hi
I guess if you use thin thread the result might look much better or increase the canvas size

maybe. i will try next project on bigger canvas.

@mojsen
Copy link

mojsen commented Jan 28, 2021

Hi @i-make-robots

I used python code to do RGB version.
The process i followed is each thread have a copy of original image .
so after finding the nail the line drawn is drawn on the copy of image.
While calculating the distance i converted rgb to lab and used euclidean distance formula.
And to calculate the average of pixels between two nails i used another formula.
The results are not so promising
Attaching the result.
image

Hi. Can you share your code?

@arun-sagar
Copy link
Collaborator

Hi @mojsen
I don't think my algorithm is efficient .
If i crack the most efficient algorithm, definitely i will share the code

@arun-sagar
Copy link
Collaborator

Just an Update
If you are finding the similarity between two colors using euclidean distance with r,g,b values, it won't yield exact results.
Convert r,g,b to Lab or Hsv and use the euclidean distance formula.

@i-make-robots
Copy link
Collaborator

i-make-robots commented Apr 18, 2021 via email

@arun-sagar
Copy link
Collaborator

If we're using the RGB colorspace the difference between 2 colors isn't the same as how humans perceive the difference though.
https://stackoverflow.com/questions/9018016/how-to-compare-two-colors-for-similarity-difference

@i-make-robots
Copy link
Collaborator

i-make-robots commented Apr 18, 2021 via email

@SachitChawla
Copy link

Hi, I am probably late to the party and you guys have already found a solution to the colored portrait problem. I have note read the code yet but have been very interested in making the colored versions ever since I saw the monochrome ones.
My thinking was if you :

  • generate a histogram to find most repeated colors
  • separate the colors as different layers
  • start threading layer by layer
  • a trial and error approach with variables being number of colors, number of line, weaving points etc should yield the desired result?

Would really love to know where are you with this :)

Cheers!

@i-make-robots
Copy link
Collaborator

i-make-robots commented Apr 4, 2022

Hey, thanks for writing. Welcome!

weaving_algorithm_circle uses an octree for color quantization, which is a kind of histogram of any size you want.
There is also a sobel operator used to give edges more importance than areas of flat tone.

The threads are not separated into separate layers. My thinking is to find the thread that will most improve the weaving. Sometimes that's color A, sometimes color B. They weave in and out of each other. Maybe single color per layer is better, I haven't tried it.

Most definitely there is some trial and error. also play with the number of pins, the thickness of string, the transparency of string... Art!

@arglin
Copy link

arglin commented Apr 12, 2022

I have tried this colored algo quite a while but I am still struggling. I can share you my idea and my simulation results(these results are adjusted on numberOfCrossingLinesForEachLayer, orderOfColorLayer Manually which is the part I am not satisfied with. I dont have a way to know when to stop and switch color. And also for now the process is dumb---draw different layer once and put them together, it is not practical in production):

Idea of how I did it:

  • use Floyd–Steinberg dithering algo to turn original image into an image that consists of a set of colors say Color A, B, C and Black.
  • turn the dithered image into different color layers, except for the black color layer. For the black color layer, use the gray image of the original image as the layer (don't ask me why because I don't know, all by experimental, it is the best result. The black layer is kinda form the shape of the image, make it similar to original image on shape, and other colored layers are kind add color information to the result)
  • for each layer treat as gray image and draw lines with my algorithm: https://github.com/arglin/linetoart-core. The idea is similar with the gray algo here, find the best next line everytime, just the scoring system is different.
  • experimentally shuffle the order of the layers(the black layer is always on-top) and put all layers together

Here are some simulations:

Simulations:

color_2
color_3
color_1

Drawbacks:

really depends on the control of ColorPlatteSections, numberOfCrossingLinesForEachLayer and orderOfColorLayer (black always on top). All are manually set.
Those simulations are good results, bad ones are really bad.
And because the black layer is always on top, the result is not that colorful because of the black layer is on top.

@i-make-robots Hope this may help, I am also working on it. Thank you for your work, I tried it and it is doing great.

@Neyestan
Copy link

@arglin
You did a great job, specially the 3.rd one is very nice.
Well done.

@Atanaelslompo
Copy link

Wow

@Atanaelslompo
Copy link

photo_editor_ds_1678980036013.png.jpg

@arglin
Copy link

arglin commented Apr 4, 2023

@Atanaelslompo That looks great! Can you share your idea on how to make the color ones?

@Atanaelslompo
Copy link

estou trabalhando neste codigo ainda

@oolucass
Copy link

oolucass commented Jun 24, 2023 via email

@i-make-robots
Copy link
Collaborator

https://github.com/MarginallyClever/weaving_algorithm/tree/master/weavingSeparateLayers
is a new branch that runs one layer per color. Please try it and send your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests