0

I need to detect the most shared center among these semi-circular shapes:

enter image description here

I tried with the MATLAB implementation of the Hough Transform but whichever radius range I choose it does not find any center, so is there a way to find a solution using the openCV library?

EDIT: as someone requested what did I try, I tried the example here: https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_houghcircles/py_houghcircles.html

import cv2
import numpy as np

img = cv2.imread('opencv_logo.png',0)
img = cv2.medianBlur(img,5)
cimg = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR)

circles = cv2.HoughCircles(img,cv2.HOUGH_GRADIENT,1,20,
                        param1=50,param2=30,minRadius=0,maxRadius=0)

circles = np.uint16(np.around(circles))
for i in circles[0,:]:
# draw the outer circle
cv2.circle(cimg,(i[0],i[1]),i[2],(0,255,0),2)
# draw the center of the circle
cv2.circle(cimg,(i[0],i[1]),2,(0,0,255),3)

cv2.imshow('detected circles',cimg)
cv2.waitKey(0)
cv2.destroyAllWindows()

but applying this code to myimage, no center is detected.

Ciccios_1518
  • 435
  • 1
  • 6
  • 13
  • 2
    those are no semi-circles. Where would you place the "centers" for that image? – Micka Apr 06 '21 at 18:25
  • 1
    Please repeat [on topic](https://stackoverflow.com/help/on-topic) and [how to ask](https://stackoverflow.com/help/how-to-ask) from the [intro tour](https://stackoverflow.com/tour). “Show me how to solve this coding problem” is not a Stack Overflow issue. We expect you to make an honest attempt, and *then* ask a *specific* question about your algorithm or technique. Stack Overflow is not intended to replace existing documentation and tutorials. – Prune Apr 06 '21 at 18:33
  • @Micka the centers should be like the one in the answer of this question https://stackoverflow.com/questions/20698613/detect-semicircle-in-opencv – Ciccios_1518 Apr 06 '21 at 19:30
  • @Prune I've edited the question if you're still interested on that – Ciccios_1518 Apr 06 '21 at 19:34
  • Much better; I've retracted my down-vote and closure vote. – Prune Apr 06 '21 at 20:02
  • 1
    in the linked question there are shapes very close to circles. In your images there are no circles, it's more like ellipses. – Micka Apr 06 '21 at 20:50
  • And there are ways to extend the concept for ellipse-like shape as far as you know? – Ciccios_1518 Apr 06 '21 at 21:23

0 Answers0