4 ms·
Hi HN, OP here. I've tinkered with this problem a few times over the years, but only now am I happy with the results. This time I wrote it in Go and implemented
by fogleman 10y ago
Hi HN, OP here. I've tinkered with this problem a few times over the years, but only now am I happy with the results. This time I wrote it in Go and implemented things a bit differently that helped performance quite a bit.
I plan on implementing SVG output pretty soon. It won't be hard I just haven't done it yet.
For the Twitter bot, I'm planning on adding another mode where it posts a GIF showing the iterative progression of drawing an image.
Let me know if you have any questions or if you have ideas for other features!
- jotato 10y agoDo you have nay plans on putting a website front end on this? It would be great to upload an image and get a result
- fogleman 10y agoA few people have asked that, so maybe. Another thought was you could tweet an image to the Twitter bot and have it tweet back the result, but then your image is out there for the world to see, so maybe that's not as good.
- tkxxx7 10y agoI could see this becoming super popular in some twitter circles, though.
- antirez 10y agoI was about to create such a website a couple of years ago, but isn't this too much computational expensive to be a free service? It's going to make people wait a lot if the service hits HN or something like that. Or maybe my code was too much unoptimized and it's possible to train the images in a quite faster fashion after all. Anyway would be great to have such a site. EDIT: Now I checked better your implementation and is very different, and indeed, can be made a lot faster. What I (and others before me) do is to have a fixed set of polygons and move, rotate, change color in order to find the best arrangement. In your case instead you add shapes incrementally in order to lower the error.
- busted 10y agoIf you create a frontend, it may be a good idea to add a button for buying a print (which you could do through one of the many online services available). Some of these look very nice and I'm considering printing something like this on a canvas to hang on the wall.
- baszalmstra 10y agoabsolutely +1 for this
- OJFord 10y agoAll the +1 in the world for this. I've been browsing the Twitter bot for a while just thinking "some of these are great; I'd happily hang one".
- deleted 10y ago[deleted]
- overcast 10y agoGrab primitivepics.com NOW.
- rawnlq 10y agoThat's a terrible name if he's planning to monetize this tho.
- blt 10y agowhy?
- jerf 10y agoI assume because "primitive" generally has negative connotations. (Don't try to make rational arguments about that doesn't apply here or how obvious it is that it's not the "bad" sort of primitive. We're talking about marketing here. Rational arguments are a category error.) I'm not creative enough to come up with a positive, just some more neutral ideas that you would have the opportunity to shape, like Shapify (taken by other things though), something with "simplify", something with "fun" maybe ("fun up your photos!").
- overcast 10y agoAnd to me, Shapify is just another generic "web 2.0" name. Lost in the sea of a million other "ify" domains. The point here is that they should at least claim the domain name for their product, regardless if that is going to be the actual public facing product.
- jerf 10y agoThis is another one of those "your tone suggests you disagree with me, but you're just repeating my point back at me" posts. I told you "Shapify" was a neutral word that you can pour your own connotations into. A lot of brands are. What's a "Cisco"? What's a "Nike" in a country where most people won't get the classical allusion? What's a "Coke"?
- shurcooL 10y agoIs it pure Go? Could you compile with GopherJS and do the processing all client side?
- fogleman 10y agoThat would be cool. It is pure Go...
- oh_sigh 10y agoYou could accept DMs as well
- MasterScrat 10y agoYou could also make it an app the way Prisma did...
- comboy 10y agoMake stroke of a brush a geometric primitive and you have an interesting painter.
- pbhjpbhj 10y agoI was thinking along those lines, perhaps a general swash shape that is randomised at the edges a little.
- fogleman 10y agoYeah, I briefly thought about that but haven't tried anything yet...
- comboy 10y agoGreat work so far, I hope you can pull it off. ... Then just come up with some fake name and portfolio website because I have a feeling that people will want to pay less for automatically generated art even if in a blind test they would like it more than a "real" one ;)
- lisper 10y agoThis is really impressive. I'll bet if you printed these out as high quality giclees and didn't tell anyone how you did it you could sell them for thousands of dollars in fine art galleries.
- polyomino 10y agoYou could probably sell them even though you revealed how you did it.
- lisper 10y agoI dunno, I think a lot of the hoity-toity types who are willing to overpay for art would be put off by knowing that it was done by computer. For them, the value is in the scarcity more than the aesthetics: they want to have something that their friends don't (and can't!) have. So if it were me, I would choose not to reveal that anyone who knows how to use github and an inkjet printer can reproduce the results.
- jamesjyu 10y agoThat's not necessarily true. There are many examples of fine art which is made by computer and easily replicated by anyone. However, the prints themselves are limited in quantity (or, there may just one official print).
- lisper 10y agoOf course. But do people pay top dollar for those? I don't actually know, but I doubt it.
- RangerScience 10y agoThis is how photography nearly always worked. I think there's some early photo tech that did only result in one image, but all of film photography produced 'prints'. Although I remember growing up with one print that deliberately had a fold in it, made by the artist as part of the art.
- nathancahill 10y agoI'd love to help with the SVG implementation. I'll follow the repo. Great project.
- bcheung 10y agoNice work! As far as other ideas, morphing from one photo to the next one. Making changes (morphing shapes, changing colors, adding / removing shapes) would look interesting.
- fitzwatermellow 10y agoCan't believe you didn't input Duchamp's Nude Descending A Staircase ;)
- tripzilch 10y agoI'd love to see this, please :)
- tgb 10y agoI like it. I noticed that the oval brushes were almost always of lower quality (in the sense of doing a worse job recreating the original). I think it's because you only take axis-aligned ellipses and not arbitrarily rotated ones, which might be fun to try too.
- fogleman 10y agoActually ellipses perform pretty well. I've analyzed this a good bit... http://i.imgur.com/82Aksg0.png http://i.imgur.com/82Aksg0.png (lower is better, this shows average score over 100 different input images)
- Ar-Curunir 10y agoAs an aside, it would be nice if you could cite the original sources of the images posted by the Twitter bot; it would be nice to compare, and probably most safe legally too.
- Cogito 10y agoto add to this, I want to compare to the source image! You should definitely link to the original.
- joncalhoun 10y agoJust wanted to say this is really awesome. Nice work!
- ZenPsycho 10y agoI have tinkered with this myself. Have you tried a fitness function that doesn't just compare the source pixels, but also compares the source and approximation after each has been run through various convolution kernels, and adding the result to the overall score? it takes a little longer but it can let you fine tune things like giving a higher score to images whose edges line up.
- alejohausner 10y agoThere is lots of work on "artistic rendering" like yours, from the early 1990s to the present. It started with work by Paul Haeberli at SGI [1]. The first chapter in "Image and Video-Based Artistic Stylisation", edited by Paul Rosin and John Collomosse [2] describes many techniques you might be interested in. Have a look; you will like what you see. 1.http://dl.acm.org/citation.cfm?id=97902 http://dl.acm.org/citation.cfm?id=97902 2.https://books.google.com/books?id=YjXlTPFYGEYC https://books.google.com/books?id=YjXlTPFYGEYC
- fogleman 10y agoHey, that book looks right up my alley... I just ordered a copy. :)
- gedy 10y agoThis is great work! I've tinkered with another algorithm recently that gives similar results: http://imgur.com/a/djqnR http://imgur.com/a/djqnR Will share another time, thanks again for the post.
- anilgulecha 10y agoVery cool. One variation I'd like to see in the same algorithm is without the padding or borders, just the gradient-ed quadrants.
- WoodenChair 10y agoCan you link to the algorithm itself? Thanks - cool work.
- pRusya 10y agoAwesome! Thanks for sharing this. Feature request: combine modes(e.g. triangle+rect).
- bomdo 10y agoThe code is very readable! Especially because it's not using a lot of external libraries. Including the twitter bot is a very nice touch. Awesome! One of the key features of golang is concurrency. Your code is single-threaded, even though hill-climbing and annealing (and also all kinds of image operations) could be highly parallelized. Maybe that's something rewarding to look into at some point? If you ever find the time, can you outline your strategy for your choosing a convergence algorithm? How did your experiments go for choosing the parameters (you called them maxAge, maxTemp, etc.) for those? Why did you currently end up choosing hill climbing over annealing, here: https://github.com/fogleman/primitive/blob/master/primitive/model.go#L148 https://github.com/fogleman/primitive/blob/master/primitive/...
- epalmer 10y agoThanks. This is wonderful. I just put go on my mac and got this running in ~5 minutes. I am going to do a few images tonight and will share the google photo album as a comment to this comment when I get a chance tonight. This is very cool. Thanks.
- epalmer 10y agoNot sure anyone will see this but I rendered some photos using this great tool. I like The Black Widow and the passage way the best. https://goo.gl/photos/s7XMqTuVLayztEHf9 https://goo.gl/photos/s7XMqTuVLayztEHf9
- thatcat 10y agoI noticed that the alpha default is 128, but usually the scale is 0-1. Is the scale then 0 - 256 for this option?