Finding centre of an object

Ask gaming related questions (AHK v1.1 and older)
autohotkey11
Posts: 12
Joined: 11 Nov 2020, 01:03

Finding centre of an object

Post by autohotkey11 » 01 Dec 2020, 09:38

Image Broken Link for safety

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Finding centre of an object

Post by swagfag » 01 Dec 2020, 11:49

with opencv, first u isolate the red channel(or whichever one gives u the most consistent outline), then u clean it up with some morphological transformations, blurs/sharpens if need be, then u make a cv contour out of it. divide its moments to obtain the centroid(if thats what u meant by "center". its not exactly clear from the image): see https://en.wikipedia.org/wiki/Image_moment#Examples

autohotkey11
Posts: 12
Joined: 11 Nov 2020, 01:03

Re: Finding centre of an object

Post by autohotkey11 » 01 Dec 2020, 14:58

i don't have too much experience with opencv is it possible to make a multi detection of one pixel color? for exemple i want to detect all pixel with the same color on the screen then after that make the geomertic form and try to detect the centre of that geometric form made by this groupe of pixel?

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Finding centre of an object

Post by swagfag » 01 Dec 2020, 17:58

is it possible this, is it possible that. many things are possible. and many are not. depending on the degree of expertise and all.
what ure describing is possible. is it possible out of the box? no, ull have to implement the algorithms that make it possible urself. i dont know why u would want to waste ur time doing that, considering the heavy lifting has already been done for u(by knowledgeable opencv contributors over the course of many years)

Post Reply

Return to “Gaming Help (v1)”