1 | initial version |
OpenCV has a couple techniques you can try and there is another that I don't think is in OpenCV.
warp polar
I cropped a single dial and used extract channel and threshold to get the circle you detected. See the 2nd and 3rd images below. Use this circle in Opencv's warp polar function to "unwrap" the circular dial image into a rectangle. Then search the rectangle for the dial line as the brightest horizontal region in the 4th image below. I have used this in the past to find dials on clocks and meters.
mask + threshold + line detect
Create a mask (3rd image below) of the circle detected with Opencv's circle drawing function or floodFill function. Use this mask to extract the interior of the dial. You can use copy function with a mask for this. Find the brightest pixels in the masked image (4th below) and use Opencv's fitLine function to get the dial line.
Circle stepping
Use the Bresenham or Midpoint circle algorithm to step around concentric circles whose radii are less than what you have detected. When you find the dial line as the largest intensity, store this point in a list. Use the list to find a best fit line. I don't think Opencv has a circle iterator that implements either of these stepping algorithms. You could try to use OpenCV's ellipse2Poly function but it gives you a sequence of points that define polyline that approximates an arc or circle. This may be good enough.