BTW I love what you made, have you considered selling those? It looks like it could have a similar business model as instapainting: http://instapainting.com/
I am the creator of https://comments.network/ which
you are using on the bottom of the article, and it's
the first time I spot it in the wild!
That's pretty cool! I made my own version of this a few years ago, and if anyone is interested it's open source:
https://github.com/jeffkaufman/webscripts/blob/master/commen...(Mine can also do facebook and google plus, though to do facebook it needs an API key.)
Selling is not going to be my intent. I feel this should be left to the artist behind the original idea. But indeed instapainting's model seems like a nice fit.
Increasing the amount of pins thus resulted in a far better result for the same amount of computational power than the improved algorithm you propose.
I suspect that a forward-look of 2 or 3 will give a noticeably better result, particularly if you combine it with the length-normalised score like was suggested by another commenter. Using a Dykstra algorithm and taking the first path that reaches length N should also keep the branching reasonable.
If you haven't seen it, there was something similar (algorithmically) for the FaceBull problem, which should still be kicking around online somewhere.
I am curious, how would the final quality of the result be affected by:
- Changing the shape to say, a square. Or maybe a circle is optimal given a limited number of points.
- Inreasing the number of endpoints. There must be some limit to this. For example, even giving an infinite number of endpoints would not look like a photo, but how much better could it look?
- For now I have only looked at circular looms although various shapes would indeed give some interesting result. A circle however gives an great even distribution of possible lines and thus resolution.
- The number of endpoints greatly improves the resolution of the final image. The smaller the number of endpoints the more prominent the actual spacial patterns of the loom become.
Might be cool to try including pin position as part of the optimization.
Unless your image library is way fancier than I imagine, you would get a much less biased result if you convert to a linear color space. This code:
# Invert grayscale image
def invertImage(image):
return (255-image)
doesn't accurately compute amount of thread cover desired because "image" isn't linear in brightness.For this particular use case, though, you probably want to further transform the output. Suppose that one thread locally reduces light transmission by a factor of k. Then two reduce by k^2 (assuming there's enough blurring, everything is purely backlit, no reflections etc), and so on. So n reduces the log of the brightness by n*log(k). I would try calculating -log(luminosity) and fitting threads to that.
Finally, this sounds like a wonderful application of compressed sensing. I bet you could get an asymptotically fast algorithm that is reasonably close to optimal.
imgMasked = np.subtract(imgMasked, lineMask)
By the following lines: lineMask = np.subtract(np.ones((height, width)), lineMask)
imgMasked = np.multiply(imgMasked, lineMask)
lineWeight is now equal to the k you propose.(Might be that it tries to optimize for edge contours)
https://github.com/danielvarga/string-art
My algorithm uses a bit fancier math: I reformulate the approximation problem as a sparse least squares problem over positive integers, solve the relaxation, and truncate and quantize the solution. It works quite well in practice, check out the images.
Personally, can't say I understand image pre-processing well but did you notice that original Petros Vrellis images have deeper black color in some parts like face edges or hair and much lighter parts in cheeks and foreheads which creates a more detailed portrait?
Also, this name reminds me Jason Bourne movies as they have Operation Treadstone there.