I'll explain what I want to achieve with an example. Let's say we get the following picture:
I would like to write code that calculates the x and y coordinates of the entire circumference/perimeter of the object inside the image with a certain colour (R 225, G 158, B 158). In this case the object is a huge circle, but it could be any shape and size.
So I basically want my code to write all the x and y coordinates of all the corners that make up the circle. And with corners I mean the corners of the pixels that you see when you zoom in on the circle, like this:
My question is, is there an easy way to achieve this? I have searched for an answer, but I couldn't really find anyone with the same quest/problem.
Things to know:
- The object could be a different shape in every image, it could be a country, a car, a banana, anything is possible.
- The object is almost always completely filled in(like our example). But it could also have a hole in it (like a donut), but not more than 1 hole (so a pretzel wouldn't work). When there is a hole, I would also like to know the coordinates of the inner perimeter/circumference.
- The colour is always the same colour (R 225, G 158, B 158)
- The pixels containing this colour will always consists of this colour for 100%, so there will be no fading colours or anything like that.
I would love to know if you guys know of any ways to do this and maybe know of some examples I can learn from.
(I am also super new to python, so if I missed something obvious, please tell and i'll update/edit my post)