Answer the question
In order to leave comments, you need to log in
How to find circle coordinates on canvas?
There is this image:
How can I find the coordinates of this circle?
(That is, in the task, the circle is in a different place each time. I need to process the image and find the circle)
Answer the question
In order to leave comments, you need to log in
I believe this problem is easiest to solve "on the forehead" by enumeration:
var bestCircleness = 0;
var bestX, bestY, bestRadius;
for (var x = 0; x < width; x++) {
for (var y = 0; y < height; y++) {
for (var radius = minRadius; radius <= maxRadius; radius++) {
var circleness = getCircleness(x, y, radius);
if (circleness > bestCircleness) {
bestCircleness = circleness;
bestX = x;
bestY = y;
bestRadius = radius;
}
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question