The Mathematics of String Art
Вставка
- Опубліковано 11 чер 2024
- String Art recreates an image using string. An algorithm is used to calculate the order in which the string needs to be wrapped around the nails. This is something different from what I usually do - it's my entrance to the #some3 contest.
Chapters:
0:00 Problem statement
0:39 Intro
0:51 Rules
1:13 Image model
2:05 Lines model
2:50 Ax = b
4:58 pinv(A)
6:17 Yuck!
6:30 Improved Lines model
8:13 Constrained minimization
8:50 Greedy Algorithm
9:37 Finished!
10:02 Another method?
10:18 Outro
Music: Secret Agent by MILANO
Support me: patreon.com/VirtuallyPassed
---
Want to buy a custom black & white circular String Artwork? Email me at virtuallypassed@gmail.com with an image you'd like turned into string art. I can only make a few artworks each month due to limited time and resources.
---
New video on string art is out! ua-cam.com/video/dBlSmg5T13M/v-deo.htmlsi=KTr8aD_GwLb8t2u5
I'm 15 years old and I've never been particularly interested in math or programming in my entire life. I wanted to do something for my school's arts festival since I have always participated but this time I wanted to do something different. I looked up how to do embroidery and found this video by pure chance. This is simply fascinating, you have completely changed how I saw mathematics.
This comment was a delight to read. I'm glad its made you see the beauty in mathematics :)
The problem is school and school teachers. School is there to make people into unquestioning factory line workers. Don't expect to learn anything of value there.
You're basically trying to reinvent how CAT scans work. Based on the outro it seems like you've already started digging into the literature, but the first step is something called a Radon transform.
Thanks for your comment. I must confess I've never heard of a radon transform before. I'll look into it.
Or maybe an inverse Radon transform, since the image is known and it is the "projections" (string) that is sought?
@@virtually_passedYep, the first thing I thought of is that this is a great visualization of how (cone beam) CT works! It would be cool to see with a semi-translucent thread and back light. You could expand to CMYK coloured threads as well :) others have pointed out using the SVD. I'd point you to a classic computer vision paper called EigenFaces, which might be another technique for finding the weights on your basis vectors
@@Bob94390 Yeah, that would be more accurate. Of course, as everyone is saying, the way one does a (inverse) radon transform in practice is through the FT. And even then one rarely does an exact radon transform because it typically creates artifacts. So (my understanding, I am by no means an expert) is that at the end of the day the radon transform is just a model and in reality one is just manipulating FTs.
are we talking about the polar formatting algorithm here? Also, would applying the projection slice theorem help?
I suppose projection slice theorem can be problematic since the string here is of uniform density.
Congratulations on winning #SoME3. You had a great explanation, I can't wait to see more!
I'm super interested in the FFT video! I'm also interested in how you went about making the machine to do this IRL, as well as the considerations for string tension and the like
That's exactly what I was wondering. Thanks for this comment!
Congratulations to the author for this amazing video and all of his brilliant ideas, +1 sub, hoping to see the next video about fft algorithm :)
The machine looks pretty simple actually. One servo motor to rotate the turntable and another one to hold the string inside or outside the nails
@@thewhitefalcon8539 yeah, and then you just code it in such a way that you never have to go over halfway around the circle in one direction on a single sweep so then you don't have to worry about keeping tension on the string while the length is contracting. I didn't realize this when I wrote my original comment, though
@@slightlyenlightenedlayman Even if you did, you'd have the string spool on some kind of springy rotating mechanism like what winds up a clock
I think FFT works here because the matrix is circulant - it's like with polynomials
I enjoyed this, as an artist and previously being an analyst/programmer, I found this fascinating.
Awesome. I know so many analyst/programmer-turned-artists! I think once you gain the power to be so creative, some people just can't stop creating!
The beauty of linear algebra, optimization and creativity in one single video.
I so want to program this in python/numpy now.
Grate work.
Drawing an eye is spectacular art.
Creating an algorithm and a machine that can use it to make art is PURE GENIUS, outstanding how far our brain can go!
Awesome video! I like how you showed what happened with an early attempt for the black-white fall off curve.
Thanks!
3:57 line 3 was a little excited to get streched out into a vector XD! Greate video. I love seeing math and programming come together!
1.9k views??? Wtf? This is an incredible quality video and you’ve put a ton of hard work into this I can see. It’s reminiscent of stuff made here and 3b1b put together. Thanks for sharing, and I hope it reaches tons of people as it deserves to!
Always starts from small amount of viewer
We're at 19k!!!
In fact, people tend to choose watching someone shaking their butt rather than watching math.
@@lost.in.maze.official Uh, 3blue1brown is a example of the contrary. Grant gets millions of views on nearly every video they make, even on very obscure topics. Granted, (heh) they're an outlier, but still.
Also, it might just be that string art is too obscure of a topic and the mathematics of such a thing are not immediately attention-grabbing. The thumbnail might also be to blame. It's very muted and gray, so it doesn't stand out among other thumbnails.
@@nikkiofthevalley He's not wrong. People'd rather watch others do stupid stuff or entertainment. It's obvious when you look at the most popular people on the platform.
My very first thought was this was going to be a Fourrier transform thing, then you told us about the matrix stuff. But alas, I got redeemed in the end!!! Great video.
This is utterly fascinating. It is truly one of the best representations of how to convert an algorithm into a practical situation. And combine that with art and you have magic and humanity.
This is really nice. Thanks for making it and goo luck in the competition!
That’s brilliant. It is always easier to internalise math stuff when its being presented by some real example. Humanity needs more of this❤
I've been fantasizing about this machine for so long. You are my hero.😂
This was surprisingly interesting and inspiring. I appreciate the well structured video, you didn't drag it out and the video delivered what it promised - one minute in, and you got me thinking about how this could be solved. You presented a solution, but left room for experimentation - great video!
one of the best recommendations by 3blue1brown
Thanks :)
The results are so striking, and I love how you talked through your thought process
It's nice seeing I'm slowly starting to understand these math videos.
This brings me back to my ML courses. Looks so similar.
This video made my head spin. the visuals are super helpful and the fact this works is truly impressive to me.
great video. nice visuals. i love how you explained this interesting concept so simple with just enough depth to understand it (and remember) and not too much depth, so it doesn’t get boring
Glad you liked it!
You are why internet exists. Good work sir!
So beautiful, interesting and educational!
Glad you think so!
Awesome explanation! Loved it.
:)
That's so interesting. Your demo got me thinking about some ML algorithms, like the MSE loss function. Thank you!
Please make a video with more details on the machine. Awesome video, eagerly waiting for another on the other algorithm you mentioned.
I saw art like this on Pinterest months ago, and I wanted to recreate it. But I couldn't find anything on the process used to make it. So glad I found this video.
What an absolutely beatiful video, just loved every bit of it! Looking forward to the fourier transform approach video too! Thanks for this quality content!
Glad you enjoyed it!
Thanks. I enjoyed watching something useful for a change.
Extremely well made video. Easy to understand and follow even without massive amounts of math knowledge. FFT video also sounds interesting, not sure how much I would understand but I want to watch it still
It is in fact interesting, thank you.
This channel is about to boom 💥
And it deserves to!
Awesome content
Thank you 🙌
I passed my Fourier Analysis course this past semester. This is how my brain went during this video.
Me at the start of the video: minimisation? I see! He's going to use a projection and use a Fourier Transform!
Me part way: Oh... so no Fourier Transform...
Me at the end: AHA! There it is!
Super looking forward to follow-ups on this! Great video, neat project, and just yeah, very cool. :)
Mathematics is Art, glad to see Art being Mathematical
Came from 3B1B's video. Will be staying for good math videos 😁.
Welcome!
I liked this a lot because I learned all the math from the video last year in university and this video shows me how it is actually used. Very cool stuff
This video is so good please make more into this topic i love it!
Very imperative! Math is definitely beautiful!
Oh man, that is fascinating! I know it's for a contest, but I would love if you made the entire project open source with CAD and code so others (myself included) can make this project and learn by doing 😀
With all due respect, that's honestly a pretty unfair ask. While I know it's not how you intended it (I agree that it would be FUN to recreate this at home), but from an engineer's perspective it feels like you're asking for someone to give away for FREE the product that they worked so hard to conceptualize, design, prototype, code, troubleshoot, refine, and present. If it is someone's intention to do all of this work for it to be freely available, that is a decision that they have made on their own, and have somehow justified, and that's fine; but to REQUEST that they give it away comes off as lazy and entitled, and implies that their expertise and effort has no value. There is more than enough information presented here for someone like yourself who is interested in making such a device to find tutorials and explanations that are already available for individual aspects of the project. By taking this route, you will truly learn by doing, but in the process learn far more and be more capable of creating your own UNIQUE product in the future!
@@jhboulder hmmmm... I also wonder how much of this project has been built on others' open source work? Seems to me that the monetization of that knowledge would be fairly disrespectful to those who believed that knowledge should be openly shared. But that's just my opinion and you by no means have to feel the same. I simply feel like if someone has learned for free, they have a duty to provide their own knowledge to the world the same way. I'm almost done my first project and am excited to share the model freely. I hope you stumble upon it and enjoy!
@@nadimfetaih3841 there's a lot to unpack in that statement. "Open Source" seems to be a more complicated concept than I gave it credit for in the past. Speaking to the comment of 'monetization of knowledge that was gained for free', there are TONS of companies out there that are making money off of products or services that use pieces of Open Source projects, but because their end product is clearly distinguishable from other's finished products, it is generally considered acceptable for them to make money from these products and services. Major software companies are notorious for this, especially Google, Microsoft, Apple, and other similarly large software companies (not to imply that I think that these are the pinnacle of ethical business practices). Quite often, the bulk of the code that is used is just a copy-and-paste of snippets of code from somewhere else that they know already works, so they simply adapt it to their needs. As for the 'they have a duty to provide their own knowledge to the world' again speaks to our current cultural state of entitlement. We have come to expect that if someone else got something free, we should get it for free too. While I can understand where this feeling comes from, I still have trouble completely getting behind the thought that receiving something for free implies that you now have an OBLIGATION to pass it on for free. However, I CAN completely agree with that statement if it's changed ever so slightly to: "if someone has learned for free, they SHOULD CONSIDER PROVIDING their own knowledge to the world the same way." Everyone's situation is different, and there can be very valid reasons to not simply distribute it freely, anything from 'easy access to this could be harmful to society' to 'rent is due, so I need to make money off of my efforts to provide for my family' and a million different reasons. Thanks for respectfully sharing your opinion, and I hope that your maker journey is a successful one!
@@jhboulder Some people actually like to give away their work. Asking costs nothing. It's a binary answer. Being asked doesn't mean you have to say yes.
Buying something is lazy and entitled. Making something from someone's designs takes time and effort and is very educational.
Sharing enriches everyone. The opposite of sharing is just sad.
@@jhboulder You suggesting that them asking an innocent question is unfair is pretty unfair. I have no respect for the way you answered or your expressed opinions, their question is not freeloading and does not imply that the OP's work has no value. In fact asking for a way to interact further with an authors work does the opposite, it expresses that the work has value.
I would absolutely love to see the source code. Amazing work!
So what the heck is that machine at the start? Thats like a video in of itself.
My heart sank a bit when there was no github repo in the description. This was an AMAZING video, thanks for sharing this knowledge!!!!
Such a cool and simple video!
So refreshing! You just mentally returned me to the first year of university. Thanks!
Very good video man. Totally made my day. Congratulations on creating such great content!
Glad you enjoyed it!
I want the FFT version video please, that sound like fun
It's on the list :)
Super cool! Amazing video!
This is some kind of string theorie I would love to see 😄👍
Amazing video. This helped me understand more of Matrix math and greedy algorithms. I hope to see more videos from you
Amazing video. Loved it.
Linear Algebra was hands down my FAV math course.... Great Video gonna watch more
Fascinating video. Thanks for sharing
such an awesome video, wish you all the best
I would absolutely love to see more videos on this subject, especially on the machine shown at the beginning
Great video. I would love seeing the other algorithm you talked about in the outro and making of the Machine
Likely recommended by youtube after I watched some video about CT scan reconstruction using FFT and weighting (which was quite good, but I don't recall much and I fall asleep during 2nd video explaining CT with ray cone rather than parallel rays}. As some people mentioned, very similar are hough/radon transforms. I guess they differ only in opposite aproach to description.
Found this Masterpiece from SoME3😄
:)
Super cool! I wanted to know how this sort of thing is done before. Thanks for the clear and easy explanation. I would love to see your FFT version of the subject matter!!!
Congratulations! Some3
Thank you!
Congratulations! You know why🎉
Thank you!! 😁
This is so good and I want to see so much more string theory.
Great video, thanks for making it!
One of the best videos I ever watch...
You have easily earned a sub! This is criminally under watched
So cool! Hoping to see a lot more content from you! Very very cool!
More to come!
I’m teaching math for 10 years and almost every student asks, why do we have to study maths. And every time I explain it, I feel like I’m trying to explain a cat why do I need a smartphone!
Personally as a (when I was) teenager 50% homework+ 20% semester exam got me a 70, C-. I had one teacher I liked. Although my math instructor was cool too. I didn't hate math but I never studied. It was only until I was 25 I took an IQ exam that my spacial relations was above 95%. I can see mechanisms in my head, and did study computer aided drafting.No one took the time to find out my strengths. I realize now that I cannot see numbers horizontally but I can see them vertically(in my mind). It weird try it with your kids. Converting maths into visual representations is impactful to comprehend meaning. Reading set theory for myself made the foundations of calculus relatable. I am dyslexic so could be that too. Also, contextual kinetic imagery. Just thinking about what the surface of a material feels like from memory can help with visualizations. Like if you could reach out and grab something and shape it, like a piece of clay. It helps control your concentration. I study math now on and off, but I realize that my imagination is restricted by not understanding certain aspects of mathematics. Hope your kids don't drive you nuts good luck. Thank you for being a teacher for slackers.
I coded one of these. I'm deeply intrigued by the way of looking at it you have since it's quite a bit more involved than the way I had of doing it. It also seems much much faster since it took my method forever. Very well done.
Oh wow, may I ask what method you used?
@@virtually_passed Instead of looking at all of the pixels that the line intersected or looking at the local neighborhood I just, hmmm actually it's been a while let me look at my code, ok I just looked at the one with the closest center for each in a rough line. So what I did was for slopes less than 1 I used an equation for a line solved for y and rounded, then for slopes greater than 1 I wrote the equation the other way around solved for x and rounded. Then I took the total darkness of all of the pixels along the potential lines and found the one that was darkest, then I subtracted some from the pixels along that line to produce a new image. It may have been a bass ackward way of doing it though, I'm certainly not saying I did it "right" or "well" or "competently" but it did end up working with a little tuning. Also the machine you showed looks super cool.
Really nice to see! Looking forward to the next movie :)
really amazing explanation and animation! subbed! :)
Amazing, love it!
Glad you like it!
Immediately thought it reminded me of FFT, happy to be validated on that. Looking forward to the next video.
I thoroughly enjoyed this. I myself took out a pen and paper and attempted this approach on paper, which how well-made mathematical videos should feel. Wish you further success.
Thanks!
I'm watching your series on differential equations and it is fascinating.
Thanks! I plan to make a lot more of those
honestly superb video, really interesting how you problem solved this
Glad you liked it!
The last part seems to resemble how Stable Diffusion works, sort of. You draw a thread and see: if the resulting image gets closer to the target, keep it, otherwise remove it. Add one more thread and repeat...
We produce string art by placing nails all over the canvas and the algorithm is very similar! It doesn't only look at brightness though. For example it limits the number of threads per nail and it avoids completely white parts of the image.
9:15 that was my solution i thought about after hearing string art and thinking about it for a minute.. glad i wasnt far off.
got university flashbacks after i heared pseudo inverse something something and for a secound i thought OH YEAH FOR ONCE ITS USEFULL.. but nah :D
edit: 10:15 oh my god, you are great :D
I originally thought this could be solved for continuous images (eg: bezier curves) by making some scoring function based on the distance of the string to the curve and using simulated annealing or something similar to optimize it. But your least-squares discrete optimization didn't disappoint
I wonder if you could decompose a colour image into RGB, solve each then do three runs with red/green/blue string. I know they'd cover each other up to a certain degree, but I'd be fascinated to know if you could make colour string art using this technique! Perhaps allocate each nail a colour, so you've 1/3 the "resolution" but no masking of one colours' string by another. Anyway, fun to think about!
Yes you can! Although I'd recommend CMYK instead of RGB
You could even add a white string that could 'cancel out' a line of color at a certain interval, like, at the very end, or in between certain colors. I wonder if this would show up graphically.
Maybe also use the Bayer filter to mosaic the colours and reduce the number of strings used.
Very, Very cool, thank you.
❤❤❤❤❤❤Did see a video about a string machine. And i was wondering what crazy math wee need to make something like this xD
Super cool thanks :D
Glad it was helpful!
bro that's brilliant !!
Thanks!
The first thing that came to my mind at the beginning of the video was Fourier transform
You've gained a new sub. This is amazing!!
Yay, thank you!
Well, this hooked me. Subscribed!
This is very nice! I'm currently a 3rd year undergrad pursuing my BA(? (I don't know if in my country what i'm studying is equivalent to a BA) in mathematics. When I saw the title I did not imagine the math behind this would be, simply, linear algebra. Awesome video! Now I know something interesting to tell others about!
I basically learned all this in university, but only after watching this video i really understood what I'm actually calculating there
Wait, do we get to see more of the machine? I want to see a video about building that!!
wow building such a robot was on my todo list too! awesome to see someone else building exactly the thing i wanted to build
Amazing! thank you !
Instasubbed! I love this. Have had a sort of mystical fascination by circular dynamics like this ever since I discovered timetable multiplication. Thank you and I would love to see more videos on the subject!
Oh and did you build the machine yourself? Would love to see a video about the machine itself!
Great video, really interesting.
Glad you enjoyed it! Next one is almost done
Very very interesting.
Things like this are sweet.
Beautiful! Well done good sir!
Glad you like it!
This video exploded! Glad to see it's getting the attention it deserves.
Thanks
Thanks, very cool. I appreciated the explanation, but I want to see more of that machine and its results! Please post. Thanks!
this is fucking beautiful