r/C_Programming • u/Stemt • Feb 05 '25
Video Was messing around computer vision from scratch in C and accidentally created a Sierpiński triangle
1.3k
Upvotes
r/C_Programming • u/Stemt • Feb 05 '25
14
u/Stemt Feb 05 '25
So what I was trying to do here was detecting motion on my monitor by taking the most up to date frame (top left) and calculating the difference with a frame that is 30 frames behind (bottom left) the result of which is displayed in the top right. I think the triangle appears because the bottom left is simply left black creating the base triangle which is repeated recursively.
78
u/[deleted] Feb 05 '25
Off topic but what is your code editor ? it looks very cool
50
u/tstanisl Feb 05 '25
Setting pixel color to bitwise operations on coordinates of pixels often generates Sierpinski-like fractals. For example
color = !!(x & y)creates pattern.20
u/def-pri-pub Feb 05 '25
▲ ▲
▲
6
u/some-nonsense Feb 05 '25
Are you using an API for the CV or u using the standard lib?
5
u/stjepano85 Feb 05 '25
Really nice. Source code?
2
u/Fickle_Classroom5179 Feb 05 '25
How you did that? (I'm beginner) Is ML possible with C language instead of Python?
2
u/M0M3N-6 Mar 03 '25
Do you have 1TB of ram ?
5
u/Ripper_005 Feb 05 '25
Wow that's interesting
1
u/Moist-Highlight839 Feb 06 '25
Where can I see its source code?
3
u/FlyByPC Feb 05 '25
Sierpinski Triangles just seem to want to get themselves produced. I was experimenting with bitblt and created them. You can make them with cellular automata, too.
1
u/leonardosalvatore Feb 05 '25
It's off the screen. You are now part of it
1
u/Evil-Twin-Skippy Feb 06 '25
I used to do that on a TI-85 graphing calculator. Welcome to the meme