Click here to Skip to main content
15,887,365 members
Please Sign up or sign in to vote.
2.00/5 (4 votes)
See more:
We have a circle moving on a screen. How to find the lowest height that the circle goes on the screen
For example, on a 200 x 200 pixel screen, we have a circle with a diameter of 10 pixels. This circle is randomly moving on this screen. How can I find out to what height the lowest part of this circle has gone down, for example, to show that this circle has not gone below the height of 35 pixels?

What I have tried:

C#
 CircleF[] circles = CvInvoke.HoughCircles(grayFrame, HoughModes.Gradient, 2.0, 20.0, 100.0, 45.0, 34, 39);
   foreach (CircleF circle in circles)
   {
    CvInvoke.Circle(fieldMask2, Point.Round(circle.Center), , 
    (int)circle.Radius, new Bgr(Color.White).MCvScalar, 1);
}
Posted
Updated 17-Jun-23 2:12am
v5
Comments
Member 15627495 17-Jun-23 4:55am    
Circle_center + 10 is the point cover
bottom is at 200
if(Circle_center + 10 == 200){ "you're on screen bottom" \ }

It's by Math and bounds of your 2 objects : the circle, and the screen all border
payam mohammadi 17-Jun-23 5:16am    
the problem is that , i dont know what is the X and Y (coordinate) of center of circle , because circle is finding by houghCircles (EMGU CV)
Richard MacCutchan 17-Jun-23 7:55am    
This is not "A simple question avbout C#"; it is a question about processing image data from OpenCV. Please try and use meaningful titles to your questions.

The documentation at OpenCV: Feature Detection[^] helps you. The returned data gives the position and size of the found circles, so you should be able to get the anser from that information.
 
Share this answer
 
This sounds like a homework question. You know the diameter, so you know the height of the object. If the x, y position is the center of the circle, then the Y - radius is the bottom of the circle. Pretty simple math.
 
Share this answer
 
Comments
payam mohammadi 17-Jun-23 5:15am    
the problem is that , i dont know what is the X and Y (coordinate) of center of circle , because circle is finding by houghCircles (EMGU CV) in an image , by code i know only radius of circle is between 34 to 39
Graeme_Grant 17-Jun-23 5:50am    
You can't draw a circle without coordinates and size, typically the radius. So your question makes no sense.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900