eng
competition

Text Practice Mode

Coding Speed Test with Python

created Aug 14th, 14:02 by Shin4N


2


Rating

44 words
8 completed
00:00
import cv2 as cv
import numpy as np
def __process(_):
    try:
        _, _img = cv.threshold(cv.cvtColor(cv.GaussianBlur(_, (5, 5), 0), cv.COLOR_BGR2GRAY), 60, 255, cv.THRESH_BINARY)
        _, _contours, _ = cv.findContours(_img.copy(), cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)
        _areas = [cv.contourArea(c) for c in _contours]
        if _areas:
            _max_idx = np.argmax(_areas)
            return cv.boundingRect(_contours[_max_idx])

saving score / loading statistics ...