So I have seen edge detection all the time it's amazing right, recited to make shape detection. And I always wanted to make it so here we are. (I think it took 6+ hours to make)
Input (credit @eekboi )
This was almost 100% made by me (the color diff function I found online) to use it 1) fork then add your image and name it 'in' then in the code make in.jpeg(or .png) to simple.(ur extension) then change the scale on line 14 enjoy. Also the higher the hardness var (line 15) the cleaner the image (less bad lines) but also less good lines
PS I'll fill in the ???'s when I post this
PPS the higher the scale lower quality so scale of 2 is 1/2 scale
PPPS output is out.png
How it works:
first it takes an image and turns it into a numpy array (it's like a list of lists).
then I go through teach element in that array (which are all lists) and for each I go through all the elements in that array
and for each element I check if it a different color than the same element for the array before, if it is I add the rgb code (diff is the diff minus an offset) (diff,diff,diff) to that pixel in a new array
next I flip that array, and the base image and repeat that scan but this time only adding the pixel if the diff is bigger than the one the first scan provided
finally I convert that into an image and save it to a file
so it would look like if each step was a function:
load() array() scan() rotate() scan() save()
How I built it:
So one day I was just thinking oh if you just detect darkness change then edge detection should be so easy, so then the next day I made that it just went row by row on the pixels, I realized I would need to do this 4 times top down, left right, down top, right left.
Then someone suggested color change instead, that would make it only 2 scans, one vertically, and one horizontally, I then would mix the two outputs together, that worked but not well since it took a lot of time to do both and merge.
So the final iteration I made it flip the existing array and if the difference was higher then the current one it would overwrite it, this made it much easier as now there was 1 clean output file and no combination.
I really enjoyed making this project and I hope you enjoy using it
Where did you learn these programming languages from? I also want to learn these things but do not know where to learn from and which ones are good. Please tell me