Ask Your Question

How to ensure the position of this pattern?

asked 2015-12-15 06:02:00 -0600

Robot_Lee gravatar image

updated 2015-12-15 22:18:01 -0600

Recently we are comparing for a robot competition. There is a task that needs our robot to grab the fan blade. we decide to use image technology to complete the mission. However,it's not easy to find the center of the circle.Because the edge is not obvious. What should I do? image description image description image description image description

edit retag flag offensive close merge delete


How is your robot's arm?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-12-15 06:18:17 -0600 )edit

To grab the fan,so we want to know the position of the fan.Do you have some suggestion

Robot_Lee gravatar imageRobot_Lee ( 2015-12-15 06:24:53 -0600 )edit

Yes: if it is blue, then do a find contour and compute the mean of the contour points, this should return the meddle, if the image is not cropped and the center of the fas is shifted close to a border. Then you'll get a wrong middle

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-12-15 07:07:30 -0600 )edit

Other idea is to detect the V shapes and the mean of the points (in the bottom of V) should lead to the center

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-12-15 07:16:46 -0600 )edit

V shapes?How to detect it?I think it is not standard V shape neither.

Robot_Lee gravatar imageRobot_Lee ( 2015-12-15 07:26:07 -0600 )edit

I have forgotten the quotes: "V shapes": the between-fan-blades thing (you have 3 such shapes). If you detect the the points on that contour, then by computing the mean you'll get the meddle

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-12-15 07:48:49 -0600 )edit

If your fan is always going to have such a nice blue color, then go for segmentation!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-12-15 08:06:19 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-12-15 18:36:47 -0600

Tetragramm gravatar image

updated 2015-12-15 18:44:18 -0600

Conveniently, OpenCV has a Circle Detection function called Hough Circles.

Now, to make it easier on the algorithm, you should remove as many distractions as possible.

  • Filter the image so that only blue things remain. (I used Blue-0.5Red-0.5Green)
  • Run the circle detection.
  • Filter the circles returned, because the center had better be in the Blue.
  • It should also be near the geometric center of the blue.

Hopefully this helps.

Oh right, here's one of your test images with circles drawn on it. It's using the default parameters from the example in the documentation, except I made dp=4.

One of your Test Images with Circles Drawn on it.

edit flag offensive delete link more


Thanks for your answers.However,it is not easy to detect red circles. The fans have two diffrent color:red and blue,I don't know the reason why "houghcircles" can't work it well. Pictures of red fans have been added to the question.

Robot_Lee gravatar imageRobot_Lee ( 2015-12-15 22:20:17 -0600 )edit

You are correct, red does seem to be much more sensitive to settings. I suspect the more complicated background is to blame, in part. Both of the blue images are against white, mostly.

Tetragramm gravatar imageTetragramm ( 2015-12-16 17:54:51 -0600 )edit

Ok, here's a thought.

  • Filter your image, and binarize it with Threshold. (red or blue, whichever, do the other color after)
  • Find the Centroid (or centroids, if you have multiple fans in image, you can segment)
  • Convert the image to log-polar around the centroid. Each column of the image is a different radius circle from the centroid.
  • At the largest radii, where the circle touches the three blades, you'll have three peaks.
  • Take one of those, or average a section of columns together. If you're centered, they're evenly spaced, 120 degrees apart.
  • You probably aren't, so use the inscribed angle theorem (Not sure how, can't be bothered to do the math more than enough to show it works.) to find the direction and distance to move to the center.

Does all that make sense?

Tetragramm gravatar imageTetragramm ( 2015-12-16 17:56:02 -0600 )edit

Upon further reflection, I have decided that that is a "clever" solution, and is not to be trusted.

If you have lots of time, give it a shot.

Otherwise, I would focus on using a centroid method to generally localize until you're close, then tune the Hough Circles for the close up case. Perhaps do something to enhance the edges on the circles so they stand out more against the blades.

On the other hand, if you do try it, let me know, I'm interested to see if it works.

Tetragramm gravatar imageTetragramm ( 2015-12-16 20:30:43 -0600 )edit

Okay,Thank your for your help. I will tell you the progress.

Robot_Lee gravatar imageRobot_Lee ( 2015-12-16 21:00:23 -0600 )edit

Question Tools

1 follower


Asked: 2015-12-15 06:02:00 -0600

Seen: 304 times

Last updated: Dec 15 '15