Coding Challenge #50.2: Animated Circle Packing - Part 2 (Kitten Addendum)
Summary
TLDRIn this video, the creator revisits their circle packing algorithm, this time applying it to an image of a kitten. They demonstrate how to modify the algorithm to generate circles filled with colors sampled from the image itself, rather than using brightness values. The result is a unique visual representation of the kitten made entirely of circles. The tutorial also hints at the potential for using this technique with live video and suggests exploring creative image analysis methods to optimize circle placement for detailed areas of an image.
Takeaways
- 🔄 The video is a continuation of a circle packing coding challenge, focusing on visualizing a generic image.
- 🐾 The idea is to use a kitten image as a basis for circle packing, with the image being 800 by 800 pixels.
- 🛠 The initial attempt to load the kitten image failed due to format issues, highlighting the need for image compatibility.
- 🎨 The approach changes to placing circles randomly and using the color values directly from the kitten image instead of seeding based on brightness.
- 📝 The script removes the concept of 'spots' and instead uses random values for circle placement, eliminating the need for a list of initial spots.
- 🌈 A new 'color' variable is added to the circle object, and the circle creation process is updated to include this color.
- 🔢 The script uses integer conversion for floating-point values of X and Y to correctly index into the image's pixel array.
- 🖌️ The circles are filled with the color extracted from the image, and the stroke is removed for a cleaner look.
- 🐱 The final result is a visualization of the kitten image made entirely of circles, demonstrating the effectiveness of the circle packing algorithm.
- 🤔 The video suggests exploring creative ways to analyze the image for initial circle placement, such as using edge detection or other image properties.
- 🔮 The idea of using live video for circle packing is introduced, prompting thoughts on how the algorithm would adapt to dynamic images.
- 💡 The video concludes with an invitation for viewers to experiment with the coding challenge and hints at releasing JavaScript versions for browser compatibility.
Q & A
What is the main topic of the video script?
-The main topic of the video script is the circle packing algorithm and its application in visualizing a generic image, specifically using a kitten image as an example.
What was the initial approach to circle packing in the previous part of the challenge?
-The initial approach involved circle packing around letter formations, as demonstrated with the year '2017'.
Why did the speaker decide to change the circle seeding process?
-The speaker decided to change the circle seeding process to place circles everywhere and pull the color value from the kitten image itself, instead of seeding circles based on brightness values.
What was the issue with using floating-point values for X and Y when accessing pixel colors?
-The issue was that the index calculation required integer values, and using floating-point values for X and Y would not work with the image processing formula.
How did the speaker resolve the issue with floating-point values for X and Y?
-The speaker resolved the issue by converting X and Y into integers using the int function before using them in the index calculation.
What was the purpose of adding a color variable to the circle object?
-The purpose of adding a color variable was to store and fill the circles with the color values from the kitten image, rather than just using white circles.
What was the initial error encountered when the speaker tried to create a circle with a color argument?
-The initial error was that the circle was expecting a color to be passed in, which was not provided at that point in the code.
How does the speaker suggest improving the circle placement algorithm?
-The speaker suggests analyzing the image to place more initial circles where there is detail and fewer where there is little detail, allowing for larger and smaller circles to be grown as needed.
What creative methods does the speaker propose for seeding circle locations based on image properties?
-The speaker proposes methods such as edge detection or other creative ways to determine where to seed circles based on the quality and properties of the image.
What is the speaker's plan for future releases related to this coding challenge?
-The speaker plans to release JavaScript versions of the coding challenge for those who want to try it in the browser.
How does the speaker suggest using the circle packing algorithm with live video?
-The speaker suggests that applying the circle packing algorithm to live video could be interesting and could lead to creative visual effects.
What is the target number of circles the speaker is trying to create in the demonstration?
-The target number of circles the speaker is trying to create is ten.
Outlines
🎨 Circle Packing Algorithm with Image Visualization
The script introduces a follow-up to a previous coding challenge involving circle packing algorithms. The author proposes a new idea of visualizing a generic image using circle packing, starting with an example of packing circles around letter formations from a previous project. The focus shifts to using a kitten image, which is 800x800 pixels, as the basis for the circle packing. The initial attempt to load the image fails due to format issues, leading to a discussion on seeding circle locations based on brightness values and changing the approach to place circles randomly and pull color values directly from the kitten image. The script suggests removing the concept of 'spots' and restarting with random circle locations and sizes, and then adding a color variable to the circle object to store the color from the image. The author also discusses potential issues with floating-point values for X and Y coordinates and the need to convert them to integers to correctly sample the image's color. The summary concludes with a demonstration of the kitten image being represented by circles filled with colors from the original image, and the author invites viewers to consider creative ways to analyze images for more refined circle placement, hinting at edge detection or other image properties.
Mindmap
Keywords
💡Circle Packing
💡Algorithm Visualization
💡Brightness Values
💡Color Value
💡Image Processing
💡Floating Point Values
💡Pixel Indexing
💡Creative Seeding
💡Edge Detection
💡Live Video
💡JavaScript
Highlights
Introduction to the continuation of the circle packing coding challenge with a focus on visualizing generic images.
The idea of loading an image, specifically a kitten image, and exploring its 800x800 size.
Encountering issues with the kitten image due to format incompatibility, 'kitten touch JPEG'.
Concept of changing the circle seeding process to place circles everywhere and pull color values from the image itself.
Elimination of the 'spots' concept from the previous circle packing algorithm.
Introduction of a new circle object with a color variable to store the color from the image.
Error handling when the circle object expects a color to be passed in during creation.
Method of obtaining color values from the image using a formula and converting X and Y coordinates to integers.
Visualization of circles with colors from the kitten image instead of white circles.
Demonstration of the kitten image recreated using colored circles.
Discussion on the potential of applying this technique to any image or live video.
Mention of the target number of circles and the observation of circle growth dynamics.
Suggestion to analyze the image for creative circle placement based on detail and color properties.
Proposal to investigate edge detection or other methods for intelligent circle seeding.
Hypothesis on the effects of applying the circle packing technique to live video.
Invitation for viewers to explore and create with the presented coding challenge.
Promise to release JavaScript versions for browser compatibility.
Closing remarks with music.
Transcripts
hello welcome by back this is like sort
of like a part two of my circle packing
animated coding challenge thing because
you know kittens I guess so uh what if
we took that I think will be interesting
to just look at the circle packing
algorithm visualizing a generic image so
if you recall where I left it last is
it's kind of circle packing around the
letter formations here we're seeing 2017
but what if instead I were to load and
let's go to this kitten image and let's
look at what is the size of this kitten
image it's 800 by 800 so let's make the
window 800 by 800 what if I were to load
this kitten image well if I run this we
get a lot of things broken because it's
kitten touch JPEG so if we run this we
can see okay well I don't see the kitten
so one of the things I want to change
here is instead of drawing the circle
seeding the circles locations based on
brightness values I just want to like
put circles everywhere and pull the
color value from the kitten itself so a
couple things I should change is one is
we don't have this idea of spots anymore
so I can get rid of this idea of a list
of initial possible spots although I'll
discuss why that might be interesting to
bring back in and I just want the circle
locations to go back to being a a random
with value and a random height value and
we don't need spots anymore the big
difference here so there's this circle
packing thing going on again the big
difference here is I want the circle to
store a color so I'm going to add a
color variable to the circle object and
when I create the circle I'm going to
add another argument that I pass in for
color I get an error here because the
circle is expecting now a color to be
passed in so what I need to do is I need
to go
and get from that image I need to create
a color value and then pass that in so
the question becomes what pixel do I
look up well I want to look up the color
for that X&Y point and the way that I do
that is with this formula that I've used
in countless image processing videos
before where I say the index is X plus y
times the images with now there's an
issue here x and y are floating point
values so this won't actually work but
it will work if I just quickly convert X
and y into integers using this int
function and then I put that in here and
now this runs and we see all these
circles up but I need to use that color
so what I need to do here is come back
and say ah forget about a a white circle
let's fill based on that color let's say
no stroke and now if I run it we can see
here is my kitten made with circles okay
so you could do this with any image you
could do this with live video it would
be interesting and this is just one
possible way of doing it you can also
sort of think about I didn't really I
don't remember what I last left this the
target number of circles I'm trying to
create I'm still trying to create ten so
let's look at this actually what happens
more slowly and we're going to get more
bigger circles because they have more
time to kind of grow and this leads me I
think to an interesting point which is
the how I'm where I'm putting the
circles in the ultimate size of these
circles is entirely completely random
but you might think about what is the
creative way you could analyze the image
and place a lot of initial circles where
there where there's detail in the image
and place very few initial circles where
there is no detail in little detail in
the image so that you grow larger
circles and smaller circles for the
points where you need to refine to have
refine
color and and and vice versa so I think
that is something that I would love to
to investigate you could probably think
of like edge detection or other ways
what are some other
creative ways that you can figure out
where to seed the circles based on based
on the quality and the properties of the
image itself and then if you do that
with live video what would happen there
so I hope you enjoyed this little
addendum in a way it's a second coding
challenge and that you make something
with this and I'll try to also remember
to release JavaScript versions of these
for those who you want to try this stuff
run it in the browser okay thanks for
watching
[Music]
Browse More Related Video
![](https://i.ytimg.com/vi/QHEQuoIKgNE/hq720.jpg)
Coding Challenge #50.1: Animated Circle Packing - Part 1
![](https://i.ytimg.com/vi/OGf2BqcBJAo/hq720.jpg)
CapCut Tutorial: How to Create EPIC FILM with Ai
![](https://i.ytimg.com/vi/gS97PUNe2j0/hqdefault.jpg?sqp=-oaymwEXCJADEOABSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLAW73fTn_k9YW7PBFQQZoKcFsUSqQ)
Come controllare il colore con Darktable
![](https://i.ytimg.com/vi/LahtwPn6cxc/hq720.jpg)
Adjust Photo Brightness and Contrast | Adobe Photoshop
![](https://i.ytimg.com/vi/t1x5ZTI-tq4/hq720.jpg)
Text to Image generation using Stable Diffusion || HuggingFace Tutorial Diffusers Library
![](https://i.ytimg.com/vi/P76Waq23X-w/hq720.jpg)
Create a Nature Environment using Geometry Nodes | Blender Beginner Tutorial
5.0 / 5 (0 votes)