Opencv-solver/Sudoku_extractor.py
def convert_when_colour(color, img):
        """Dynamically converts an image to colour if the input colour is a tuple and the image is grayscale."""
        if len(color) == 3:
            if len(img.shape) == 2:
                img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
            elif img.shape[2] == 1:
                img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
        return img
Dynamically converts an image to colour if the input colour is a tuple and the image is grayscale.
Dynamically converts an image to colour if the input colour is a tuple and the image is grayscale.
Dynamically converts an image to colour if the input colour is a tuple and the image is grayscale .
def convert_when_colour(color, img):
        if len(color) == 3:
            if len(img.shape) == 2:
                img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
            elif img.shape[2] == 1:
                img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
        return img
def convert_when_colour ( color , img ) : if len ( color ) == 3 : if len ( img . shape ) == 2 : img = cv2 . cvtColor ( img , cv2 . COLOR_GRAY2BGR ) elif img . shape [ 2 ] == 1 : img = cv2 . cvtColor ( img , cv2 . COLOR_GRAY2BGR ) return img
Dynamically converts an image to colour if the input colour is a tuple and the image is grayscale.
Dynamically converts an image to colour if the input colour is a tuple and the image is grayscale .
"""Dynamically converts an image to colour if the input colour is a tuple and the image is grayscale."""
color
img