Skip to content

How to Identify and draw an ellipse #132121

Closed Answered by catunderrain
khoatran02 asked this question in Programming Help
Discussion options

You must be logged in to vote

Hi! I found that decreasing the threshold in the binary step to around 50 improves the results for your issue:

_, binary = cv2.threshold(image_gray, 50, 255, cv2.THRESH_BINARY)

The problem is that contours are continuous points, and with a high binary threshold, this continuity can break. Therefore, reducing the threshold helps maintain continuous zones in the pre-processed image.

I also try using morphology and increase contrast so that the zone seem more continuous with threshold 125:

clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
image_gray = clahe.apply(image_gray)

kernel = np.ones((5,5),np.uint8)

img3 = cv2.convertScaleAbs(image_gray, alpha=2, beta=0)
img32 = cv2.morp…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@catunderrain
Comment options

Answer selected by khoatran02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Programming Help Programming languages, open source, and software development.
2 participants