Fit theoretical dartboard in image containing dartboard

Hi all,

I have the following processed image:


Next, I want to know the orientation and scale of this particular dartboard. I know that a theoretical dartboard can be constructed as:

import cv2
import numpy as np

def draw_dartboard():
        IMG = np.ones((400, 400), 'uint8') * 255
        center = (int(IMG.shape[0] // 2), int(IMG.shape[1] // 2))
        size_dartboard = int(340)
        r_board = int(170)
        r_db = int(6.35)
        r_sb = int(15.9)
        r_doubles = int(162)
        r_triples = int(99)
        width_rings = int(8), center, r_doubles + width_rings, (0,0,0), -1), center, r_doubles, (255,255,255), -1), center, r_triples + width_rings, (0,0,0), -1), center, r_triples, (255,255,255), -1)
        thetas_min = np.radians([(18 * t - 9) for t in range(20)])
        thetas_max = np.radians([(18 * t + 9) for t in range(20)])
        for idx, (theta_min, theta_max) in enumerate(zip(thetas_min, thetas_max)):            
            if (idx % 2) == 0: 
                x_min = int(center[0] + r_board * np.cos(theta_min))
                y_min = int(center[1] + r_board * np.sin(theta_min))
                x_max = int(center[0] + r_board * np.cos(theta_max))
                y_max = int(center[1] + r_board * np.sin(theta_max))
                cv2.fillPoly(IMG, np.array([(center, (x_min,y_min), (x_max,y_max))]), (0,0,0))
          , center, r_sb, (0,0,0), -1)
        return IMG

I cannot share the output of the function because I can only include 1 image in this topic.

How can I “fit” the theoretical dartboard in the real image? Clearly, there is a mismatch in orientation and scale. Thank you

original image


theoretical dartboard:


what produced the first image ?

My own image processing function. Basically I threshold for black pixels, use morphological operations in the form of closing and smoothing

try feature matching and homography.

should work on the binary black-and-white images.

you can also try it on grayscale images. I don’t remember if SIFT will work on color images as is.

be sure that the model drawing’s proportions match the real thing well. it’s not a rough sketch. overlaid (with perspective correction) it needs to match fairly well.

play with samples/python/

1 Like