This is the least "cringy" channel I have seen. I have been following you since the start of last summer and you really have inspired me to continue to program stuff.
You know, if you could reverse this sort by recording all the pixel sorting, you could make a really interesting way to cryptographically hide the contents of an image, with the reverse sort instructions being the key
i've been watching this coding cahllenges for 2 hours now. One of the best channels i've seen and im waiting for more coding challenges videos. Excellent work, keep it up
I found this channel not to long ago and it has quickly become one my favourites. I absolutely love following along to all of your coding challenge videos!
Because with english as my second language it's easy to understand what he says but not so easy to understand the jokes everytime. I think he is very funny and good in explaining things.
In your 800 * 400 pixel picture using selection sort, your algorithm is doing (800 * 400) ^ 2 calculations, which is 102,400,000,000 calculations. If you were to use a more efficient algorithm, like mergesort, heapsort or quicksort, you would drop the number of calculations down to Log(800 * 400) * (800 * 400), which is 1,761,648 calculations in the worst case. That's 5,812,738% more expensive than it needs to be because of your poor choice of sorting algorithm. That's why your program was running so slow.
Daniel Shiffman I love your videos, but even the fastest computer in the world couldn't solve that problem that way faster than my desktop could with a more efficient algorithm. I was blown away when you started using selection sort.
LithiumFrost True, but it could barely even solve the problem on a relatively small picture. I recreated this in just Java and can do huge resolution pictures in 2 seconds max. This could have been a great opportunity to show how important big O really is when it comes to solving large problems. 5,812,738% is no insignificant percentage.
Well, I think you're missing the entire point of this series. The goal isn't to create beautiful and efficient programs or teach people the best way of doing something, the goal is to showcase some problem or concept and inspire the viewer to go out and create their own, better way of doing it. (which is exactly what you've done) Expecting this series to always use best practices is a little unrealistic. Just my opinion though.
I love these videos. I downloaded processing a couple of years ago and messed around with it but didn't really see much potential in it. Now that I've seen your videos I'm hooked!
I made a program that creates artificial life out of pixels. Each pixel only has one trait: color. It uses a target image to test which pixel is more "adapted" to its environment. The pixels fight it out, and whichever pixel is closer to the color of the target image in that position wins and has a slightly mutated offspring. Repeat a million times and eventually the pixels have formed a civilization that looks pretty much like the target image, except it's writhing with life. See my channel for a video called Pixel Evolution.
Hi Daniel :) I'm loving this series! I only found your channel a couple of days ago but I've been working my way through these videos and trying to replicate your code in Python, which I'm learning at the moment. Thankyou so much for the inspiration, my understanding of concepts like working with canvases through Tkinter and Pyglet is coming on in leaps and bounds thanks to your videos. Keep up the amazing work! PS. My favourite flower is the French Hydrangea
I found this channel not to long ago, and I'm loving every video! I have watched almost every single video of your p5 tutorial playlist and the coding challenges and it has helped me a lot on my programming, keep the good work!
You said you'd link to a document that explained a bunch about sorting algorhytms, but it isnt in the description. Could you please update it so that I can read it? :)
you could cheat to make the animation run faster. calculate you result picture in setup, an in draw replace the pictures. (so you are not sorting in draw)
+Daniel Shiffman (why doesn't this work anymore?!) Is it possible to calculate the algorithm with a gpu? I'm just a "hobby programmer" and don't know much about processing but there should be a way to use something like openGL.
JohnSchnee you could, but I'm not sure how efficient it'd be on a gpu, as you'd have to find a way to paralellize it on each pixel. I might try doing quicksort on opengl though, you just gave a new coding challenge
I saw your purple rain challenge and lighting was missing so, why not do a lighting challenge. One that strikes everywhere few second from 1 strike to 3 or 4 that would look cool
This is so coollll t_t I did one program similar, but it was a random paintings generator, choosing one background (that was basically a landscape, a Monet or whatever you want) + a portrait, and analysing the pixels the contrast and hue changed to make it logical :)
An idea to speed up the sorting algorithm would be to decrease the images resolution and then make each pixel bigger, so it's more notable what's going on. Also for this matter it would be nice to see something about how to increase an images dimensions by types of interpolation like bicubic interpolation. BTW: Sunflowers rules!
happy new year, Daniel! keep going with the great videos!! P.S.: i wanted to thank you this way for these coding challenges, which inspired me to start learning to code.. and since you're so good at explaining stuff, i decided to do so with your tutorials, obviously:)) P.P.S.: i love those cringy moments when you start talking to yourself:))))) have a great year!
Hi Dan, Couldn't you use any "off-the-shelf" sorting algorithm you like and customize how the pixels compare to each other? I'm sure lots of coding beginners appreciate you showing the implementation of selection sort, although they should also get used to trusting black boxes. Wonderful videos dude! Matt
Dan your tutorials are so inspiring! Thank you so much for making these, you are the sunflower that brightens our day 🌻 my favourite flower is nigella! you're like the cool coding big brother I never had...
You're so great at teaching! I mean, besides being sharp (and hyperactive? lol) it's all very down to earth and very easy to understand. Sadly, I'm not really into flowers (besides edible veggies?) but I do love your positive vibe. Happy Hanukkah ;)
processing.org/people/ 'Ben Fry and Casey Reas started Processing in Spring 2001 and continue to obsessively work on it. In 2012, they started the Processing Foundation along with Dan Shiffman, who formally joined as a third project lead.'
I don't understand ... The swap ... In JavaScript u can use tuples. There's different ways. You can: let swap = ([a,b]) => [b,a]; swap([1,2]); or [a[1], a[0]] = [a[0], a[1]]; There's always many ways.
Hello Daniel. Didn't really know where to write about it. You know how in Processing Code-Completion is Ctrl-Space on mac? That combination is already used by OS if one has a bilingual keyboard, so I can't use code-completion. I think it would be better if it was some other combination. Most commonly developers use TAB for that purpose. What do you think?
I dare you to recreate one coding language using another language! ex. using python to remake js side mission: program a mini program inside the program you programmed using a program... and record it with a recording program that you used a program to download the program that someone else programmed p.s please don't explode off the previous sentence p.s.s I loooooove your vids
I love what you do ! I don't know if it already has been said but could you use a counting sort ? It would be much faster and with the correct diplay , fun to watch ( for example seeing a pink pixel go trough the image and seeing the color counter updating, etc.. ). I just don't know if an array of 16 million int is allowed in Processing. Or create a dynamic array ?
11:19 but isn't it O(n!) algorighm? You don't start from 0 in the nested loop, so e.g. you have 10 pixels, first you check 10 pixels, then 9, then 8 and so on, so you get 10*9*8*7*6*5*4*3*2*1 = 10! loop entries. Am I wrong?
Why didn't you do a faster sort? And you should have sorted by pixel value. So it would have come out reverse rainbow color. Neat video. A great still to emulate
Really gotta wonder what makes this so slow. Kinda guessing it is the constant accessing of the pixel-array. maybe it would be faster if you copy the data to a color-array? And do the sorting there.
Hey Dan, isn't the variable creation in loop (8:32) wrong as projecting decision? I know it's just a short programm, but this style makes beginners follow the bad way of programming. Still you're awesome
Hey Dan!! Very nice ideas. Does processing (or p5.js) work with DICOM images (DICOM is kind of digital images used in medicine, mainly in diagnostic images like x-ray or CT images?
Don't want to be a hater because I love most of your videos, but in this case you could have just write a Comparator function and use it with Arrays.sort... Would save a lot of work and then you could use the efficient sorting java implements on its own.
Make a processing code draw a box around objects of interest, like a fast moving object, a small moving object, maybe have it detect Meteors and Planes!
how does the sorter know that its the brightest pixel if it cant look further down the line? or does it look at all the remaining pixels every time before deciding which one is brightest?
I like this one's simple program yet appealing results. I am curious about how would this benchmark against a native sorting function ( with improved algorithms). But I'm not sure how to get the same animation effect out of a single call to the sorting function.
cringe...?? why, because he's a happier person than you?
you're amazing, Dan!
This is the least "cringy" channel I have seen. I have been following you since the start of last summer and you really have inspired me to continue to program stuff.
Cringe cringe
Who writes cringe? Let me at him!
No but seriously, I think Dan is like the coolest teacher ever!
Cringe cringe
@@Sigfredagerbo no u
@@abdulalhazred5924 cringe cringe
@all bruh
You know, if you could reverse this sort by recording all the pixel sorting, you could make a really interesting way to cryptographically hide the contents of an image, with the reverse sort instructions being the key
I love this channel so much. Makes procrastinating better !
Cringe cringe
そうだね
i've been watching this coding cahllenges for 2 hours now. One of the best channels i've seen and im waiting for more coding challenges videos. Excellent work, keep it up
So nice to hear, thank you!!
I can't believe you replied to me! I'm so happy right now, literally you inspire me to be a programmer :DDD
I found this channel not to long ago and it has quickly become one my favourites. I absolutely love following along to all of your coding challenge videos!
I wil bingewatch all "Coding challenge" playlist tonight ^^ (not sure for spelling lol)
Coding challenge, sudoku puzzle solver. Either using recursion to solve or try to emulate a human method of solving! Great channel BTW
I wrote a blog about it so maybe you wanna have a look: opensourc.es/blog/sudoku
I LOVE YOUR SINGING AND DANCING AND FLOWER LOVING COMMENTS AND RAINBOWS!!
As a german hobby programmer these Coding Challenges are probably the best in the world.
How does it matter you are German?
Because with english as my second language it's easy to understand what he says but not so easy to understand the jokes everytime. I think he is very funny and good in explaining things.
zlyfer
Geht mir genauso. Der Typ ist bombe.
zlyfer ich verstehe alles super ;-)
GamerskingLP Ich eigentlich auch, aber manchmal verstehe ich ein paar Sachen erst nach ein paar Sekunden. :'D
In your 800 * 400 pixel picture using selection sort, your algorithm is doing (800 * 400) ^ 2 calculations, which is 102,400,000,000 calculations. If you were to use a more efficient algorithm, like mergesort, heapsort or quicksort, you would drop the number of calculations down to Log(800 * 400) * (800 * 400), which is 1,761,648 calculations in the worst case. That's 5,812,738% more expensive than it needs to be because of your poor choice of sorting algorithm. That's why your program was running so slow.
+LastRellik thanks for the thorough evaluation!!
Daniel Shiffman I love your videos, but even the fastest computer in the world couldn't solve that problem that way faster than my desktop could with a more efficient algorithm. I was blown away when you started using selection sort.
He did mention that it was just for simplicity's sake and that he could make great use of a fancy alg... 5:02
LithiumFrost True, but it could barely even solve the problem on a relatively small picture. I recreated this in just Java and can do huge resolution pictures in 2 seconds max. This could have been a great opportunity to show how important big O really is when it comes to solving large problems. 5,812,738% is no insignificant percentage.
Well, I think you're missing the entire point of this series. The goal isn't to create beautiful and efficient programs or teach people the best way of doing something, the goal is to showcase some problem or concept and inspire the viewer to go out and create their own, better way of doing it. (which is exactly what you've done) Expecting this series to always use best practices is a little unrealistic.
Just my opinion though.
I love these videos. I downloaded processing a couple of years ago and messed around with it but didn't really see much potential in it. Now that I've seen your videos I'm hooked!
That's so nice to hear!
I made a program that creates artificial life out of pixels. Each pixel only has one trait: color. It uses a target image to test which pixel is more "adapted" to its environment. The pixels fight it out, and whichever pixel is closer to the color of the target image in that position wins and has a slightly mutated offspring. Repeat a million times and eventually the pixels have formed a civilization that looks pretty much like the target image, except it's writhing with life.
See my channel for a video called Pixel Evolution.
that is really cool!
Can you upload some video showing the code working?
Have you deleted or hidden the video?
kevnar checking out!!
Dude I can't find it!
You can have custom sorting with Java with the Comparator or Comparable interfaces.
What about making the sorting algorithms yourself and not just making things even more complicated?
In what world is reimplementing a sorting algorithm less complicated than using comparators, which are designed for exactly this sort of problem?
Daniel your not cringey! :)
Hi Daniel :) I'm loving this series! I only found your channel a couple of days ago but I've been working my way through these videos and trying to replicate your code in Python, which I'm learning at the moment. Thankyou so much for the inspiration, my understanding of concepts like working with canvases through Tkinter and Pyglet is coming on in leaps and bounds thanks to your videos. Keep up the amazing work!
PS. My favourite flower is the French Hydrangea
i love u
Sunflower: I don’t feel so good
😂 😂 😂
1:54
Presenter: "Ooh look, there's a weird bar there. That's a glitch with my camera."
Hipster NFT collectors in 2021: "I'll give you 420 ETH for it."
I found this channel not to long ago, and I'm loving every video! I have watched almost every single video of your p5 tutorial playlist and the coding challenges and it has helped me a lot on my programming, keep the good work!
int j = i + 1; // start with the next pixel. why compare with yourself?
alekmoth Also the outer loop should loop while i
what if i is already the brightest pixel? then you end up swapping it with the second brightest
Somehow found your channel and only regret it 30% of the time. Keep being you man, you're awesome. Subscribed
Wow I have that feeling like I'm waiting for the next episode of the walking dead, in this case the next coding challenge xD
That is maybe the nicest thing ever.
+Daniel Shiffman hy im a kid and i love codin can you recomende me a logiciel
You said you'd link to a document that explained a bunch about sorting algorhytms, but it isnt in the description. Could you please update it so that I can read it? :)
+Daniel Shiffman can you defrich this code: 01101000 01111001 00100000 01100100 01100001 01101110 01101001 01100101 01101100 00100000 01101000 01100101 01110010 01100101 00100000 01101001 01110011 00100000 01111001 01101111 01101001 01110010 00100000 01100010 01101001 01100111 00100000 01100110 01100001 01101110 00100000 01110000 01101100 01110011 00100000 01100011 01100001 01101110 00100000 01111001 01101111 01110101 00100000 01110100 01100101 01101100 01101100 00100000 01101101 01100101 00100000 01100001 00100000 01101100 01101111 01100111 01101001 01100011 01101001 01100101 01101100 00100000 01110100 01101000 01100001 01110100 00100000 01100011 01100001 01101110 00100000 01101001 00100000 01110011 01110100 01100001 01110010 01110100 00100000 01110000 01110010 01101111 01100111 01110010 01100001 01101101 01101001 01101110 01100111
I cracked your code Agar Mobile "hy daniel here is yoir big fan pls can you tell me a logiciel that can i start programing"
I must say you are the best teacher I ever "had". :)
This is probably the only channel that teaches me something while grabbing my interest. Subscribed
Again, a life-saving video. True gold.
My favourite flower is a dandelion
P.S I also am a supporter of rainbows, flowers etc.
Oh, I love dandelions!
;-)
Great channel, and a great tutor! Thank you for being you. :)
I wish I could see this guy stoned as hell doing a challenge.
This is like arrays, for-loops and sorting basics in a nutshell. Think I'll show this to my friend who's just getting into programming
BenRangel I might recommend this to my old Comp Sci/Calculus teacher.
Could you make a machine learning program that will load a picture and try to recreate it?
What do you mean by "recreate" it?
It can already copy it and paste it
I've just discovered this channel, and I already love it. It's hard to understand but so fascinating
I didn't get a single word what you explain but watch the full length of video because it was interesting ... Good job gentle man
That outro clip with the dancing Dans is top-notch
you could cheat to make the animation run faster. calculate you result picture in setup, an in draw replace the pictures. (so you are not sorting in draw)
Yeaaah...that's what we see in every video game trailer
yes, good suggestion.
haha
+Daniel Shiffman (why doesn't this work anymore?!)
Is it possible to calculate the algorithm with a gpu? I'm just a "hobby programmer" and don't know much about processing but there should be a way to use something like openGL.
JohnSchnee you could, but I'm not sure how efficient it'd be on a gpu, as you'd have to find a way to paralellize it on each pixel. I might try doing quicksort on opengl though, you just gave a new coding challenge
I saw your purple rain challenge and lighting was missing so, why not do a lighting challenge. One that strikes everywhere few second from 1 strike to 3 or 4 that would look cool
Aero I was inspired by that video and made a demo with lightning :)
You can check it out at kamoroso94.github.io/thunderstorm
Kyle Amoroso nice that was cool, where do you write the code?
Nice, Can you share the code ?
Nadeem 460 It's on GitHub, github.com/kamoroso94/thunderstorm
Kyle Amoroso Ok Thanks I'm learning JS on my own I know C we learn it on school its a little bit similar.
This is so coollll t_t I did one program similar, but it was a random paintings generator, choosing one background (that was basically a landscape, a Monet or whatever you want) + a portrait, and analysing the pixels the contrast and hue changed to make it logical :)
cool! Would love to see this!
i dont even code and these are cool as shit. love this channel.
Game of life next episode !
ARatQuiRit I'll second that!
An idea to speed up the sorting algorithm would be to decrease the images resolution and then make each pixel bigger, so it's more notable what's going on.
Also for this matter it would be nice to see something about how to increase an images dimensions by types of interpolation like bicubic interpolation.
BTW: Sunflowers rules!
+Akhbash great suggestions! 👍
WHY MAC ?
Love seeing these videos!! Looking forward to the next one.
Love your videos, keep making them :D
This is awesome. I like your style. Not my serious C++ professor from the college.
happy new year, Daniel! keep going with the great videos!!
P.S.: i wanted to thank you this way for these coding challenges, which inspired me to start learning to code.. and since you're so good at explaining stuff, i decided to do so with your tutorials, obviously:))
P.P.S.: i love those cringy moments when you start talking to yourself:)))))
have a great year!
Hi Dan,
Couldn't you use any "off-the-shelf" sorting algorithm you like and customize how the pixels compare to each other? I'm sure lots of coding beginners appreciate you showing the implementation of selection sort, although they should also get used to trusting black boxes. Wonderful videos dude!
Matt
Yes that's absolutely correct!
my favorite flowers are hibiscus, but sunflowers are gorgeous as well :)
Dan your tutorials are so inspiring! Thank you so much for making these, you are the sunflower that brightens our day 🌻 my favourite flower is nigella! you're like the cool coding big brother I never had...
SO nice to hear, thank you!
You're so great at teaching! I mean, besides being sharp (and hyperactive? lol) it's all very down to earth and very easy to understand.
Sadly, I'm not really into flowers (besides edible veggies?) but I do love your positive vibe. Happy Hanukkah ;)
Thanks so much for the nice feedback!
If you want to understand the sorting algorithms some more, i suggest you look up the UA-cam channel "AlgoRythmics". Really great visualization
thanks for the tip!
Is Processing actually yours?
Just asking because I was wondering recently.
BTW grats for 165K subs and Merry Christmas!
processing.org/people/
'Ben Fry and Casey Reas started Processing in Spring 2001 and continue to obsessively work on
it. In 2012, they started the Processing Foundation along with Dan Shiffman, who formally joined as a third project lead.'
ingrimmmm ok
That outro is dope
Really enjoy watching the videos! You're amazing. More Java please!
My favorite flower is the Caesalpinia pulcherrima
oh, nice one!
I don't understand ... The swap ... In JavaScript u can use tuples. There's different ways. You can:
let swap = ([a,b]) => [b,a]; swap([1,2]);
or
[a[1], a[0]] = [a[0], a[1]];
There's always many ways.
please do a coding challenge for the koch snowflake, but then also with every other possible shapes
that's a great idea.
The Coding Train: what causes those artifacts in sorted result?
hi why does it say "Could not find a method to load (file name)"?
A bubble sort would of looked super cool !
And maybe a counting sort would be faster ?
Counting sort is good when there are relatively few options, here every pixel has 3 value 0-255, so you'd have 256^3 possibilities, not doable.
I don't understand a shit but I find very pleasent the way he writes the codes
Agustin Facundo sameee
Why Selection Sort??? Why not Counting Sort???
Nasturtiums are the best because you can eat them and they are pretty. Nice and peppery. We call then Nasturt-Yums!
This guy is the greatest!
To make it run faster perhaps you could make blocks with similar pixels, and the sort the blocks
I don't know about flowers but I like kittens
And I'm searching for the people that write "cringe". I'm coming for you
Hello Daniel. Didn't really know where to write about it. You know how in Processing Code-Completion is Ctrl-Space on mac? That combination is already used by OS if one has a bilingual keyboard, so I can't use code-completion. I think it would be better if it was some other combination. Most commonly developers use TAB for that purpose. What do you think?
I love these videos and I love Processing/p5.js
Image sorting sounds like an interesting way to visualize sorting algorithms.
I dare you to recreate one coding language using another language!
ex. using python to remake js
side mission: program a mini program inside the program you programmed using a program... and record it with a recording program that you used a program to download the program that someone else programmed
p.s
please don't explode off the previous sentence
p.s.s
I loooooove your vids
A rose! :)
The feeling of love and power, but if you don't look out you might cut yourself on it....
...just like the rose.
I really like daffodils... You should code checkers!
I love what you do ! I don't know if it already has been said but could you use a counting sort ? It would be much faster and with the correct diplay , fun to watch ( for example seeing a pink pixel go trough the image and seeing the color counter updating, etc.. ).
I just don't know if an array of 16 million int is allowed in Processing.
Or create a dynamic array ?
11:19 but isn't it O(n!) algorighm? You don't start from 0 in the nested loop, so e.g. you have 10 pixels, first you check 10 pixels, then 9, then 8 and so on, so you get 10*9*8*7*6*5*4*3*2*1 = 10! loop entries. Am I wrong?
i love black rose :3 it's look cool :p and nice video you have there love your videos
Why didn't you do a faster sort? And you should have sorted by pixel value. So it would have come out reverse rainbow color. Neat video. A great still to emulate
Just recently discovered your Videos
But you are the reason i wanna get into coding
Thank you :)
I'm excited to hear that!
Really gotta wonder what makes this so slow.
Kinda guessing it is the constant accessing of the pixel-array.
maybe it would be faster if you copy the data to a color-array? And do the sorting there.
Couldn't you just write a comparator?
Would be interesting to also focus on the coding practice itself. How about a test-driven coding challenge? :)
Hey Dan, isn't the variable creation in loop (8:32) wrong as projecting decision? I know it's just a short programm, but this style makes beginners follow the bad way of programming. Still you're awesome
Yes, there are lots of things I could add here to optimize and make more efficient!
Hey Dan!!
Very nice ideas.
Does processing (or p5.js) work with DICOM images (DICOM is kind of digital images used in medicine, mainly in diagnostic images like x-ray or CT images?
Don't want to be a hater because I love most of your videos, but in this case you could have just write a Comparator function and use it with Arrays.sort... Would save a lot of work and then you could use the efficient sorting java implements on its own.
Hello! I was wondering how would you translate this code for the pixels in a video instead of an image?
Oh I like this idea! Come and join the discord, maybe I can tackle this on a live stream someday! thecodingtrain.com/discord
Make a processing code draw a box around objects of interest, like a fast moving object, a small moving object, maybe have it detect Meteors and Planes!
This was actually helpful for a project I'm doing
Is there a reason you didn't just make a comparator for Color and use the built-in sort? No need to reinvent the wheel.
19:47 made my day x)
how does the sorter know that its the brightest pixel if it cant look further down the line? or does it look at all the remaining pixels every time before deciding which one is brightest?
Love the videos. Keep up the awesome work! You should do a coding challenge for Doodle Jump.
I’m from KS, so I love sunflowers! 😀
u r sooo cool for making this tutorial
I like this one's simple program yet appealing results.
I am curious about how would this benchmark against a native sorting function ( with improved algorithms). But I'm not sure how to get the same animation effect out of a single call to the sorting function.
Yea! Processing again!!
What if you make the hue the vertical position and the brightness the horizontal?
I LOOOOVE THE OUTRO 😍😂
+Daniel Shiffman, can you further elaborate on your "typo" at the end of your video? Why wouldn't you swap in the outer for loop? Thanks!
Looks like you made a program that makes cool glitch art instead of sorted images :o
Flowers and rainbown. This dude must be high af
It’s n log n algo. For every pixel you look n - i pixels.
Thanks! I made it sort with quick sort instead
cool! Please share!
Here's a link to the zip file
sites.google.com/site/nontwinbrothers/attachments/processing/PixelQuickSorting.zip
Blue roses, for achieving the impossible.