(self, image, shape, dims, color)
return image
Draws a shape from the given specs.
Draws a shape from the given specs.
Draws a shape from the given specs .
def draw_shape(self, image, shape, dims, color):
        """Draws a shape from the given specs."""
        # Get the center x, y and the size s
        x, y, s = dims
        if shape == 'square':
            cv2.rectangle(image, (x-s, y-s), (x+s, y+s), color, -1)
        elif shape == "circle":
            cv2.circle(image, (x, y), s, color, -1)
        elif shape == "triangle":
            points = np.array([[(x, y-s),
                                (x-s/math.sin(math.radians(60)), y+s),
                                (x+s/math.sin(math.radians(60)), y+s),
                                ]], dtype=np.int32)
            cv2.fillPoly(image, points, color)
        return image
def draw_shape ( self , image , shape , dims , color ) : # Get the center x, y and the size s x , y , s = dims if shape == 'square' : cv2 . rectangle ( image , ( x - s , y - s ) , ( x + s , y + s ) , color , - 1 ) elif shape == "circle" : cv2 . circle ( image , ( x , y ) , s , color , - 1 ) elif shape == "triangle" : points = np . array ( [ [ ( x , y - s ) , ( x - s / math . sin ( math . radians ( 60 ) ) , y + s ) , ( x + s / math . sin ( math . radians ( 60 ) ) , y + s ) , ] ] , dtype = np . int32 ) cv2 . fillPoly ( image , points , color ) return image