<jupyter_start><jupyter_text>Camera-Basic-Recognition O Sistema deve identificar as provas a serem analisadas, independente de sua posição<jupyter_code>import sys
def identify_alternative(image):
    try:
        gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
        gray = cv2.medianBlur(gray, 5)


        rows = gray.shape[0]
        circles = cv2.HoughCircles(gray,cv2.HOUGH_GRADIENT,1,rows/10,param1=50,param2=30,minRadius=0, maxRadius=30)


        if circles is not None:
            circles = np.uint16(np.around(circles))
            for i in circles[0, :]:
                center = (i[0], i[1])
                
                #Ponto central
                cv2.circle(image, center, 1, (255, 0, 0), 3)
                
                #Circulo externo
                radius = i[2]
                cv2.circle(image, center, radius, (0, 255, 0), 3)
        cv2.imshow("detected circles", image)                    
    except:
        cv2.destroyAllWindows()
        exit(0)<jupyter_output><empty_output><jupyter_text>Detecção de Borda(Retângulo)<jupyter_code>def identify_test(image):
    gray = cv2.cvtColor(image.copy(), cv2.COLOR_BGR2GRAY)
    ret, thresh = cv2.threshold(gray, 127, 255, 1)
    _ , contours, hierarchy = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
    contours = sorted(contours, key = cv2.contourArea, reverse = True)[:1]
    
    for c in contours:
        x,y,w,h = cv2.boundingRect(c)
        cv2.rectangle(image,(x,y),(x+w,y+h),(0,255,0),2)
    identify_alternative(image)    
def camera_processing():
    
    cap = cv2.VideoCapture(0)

    while(True):        
        ret, frame = cap.read()
        
        identify_test(frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
    
    cap.release()
    cv2.destroyAllWindows()
import numpy as np
import imutils
import sys
import cv2

camera_processing()

cv2.waitKey(0)
cv2.destroyAllWindows()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11914460285132383, 'fraction_numerical': 0.03971486761710794, 'mean_word_length': 2.484042553191489, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '489498', 'license': 'Apache-2.0', 'n_tokens_mistral': 735, 'n_tokens_neox': 688, 'n_words': 129, 'path': 'lessons/5 - Camera-Basic-Recognition.ipynb', 'repo_name': 'Sou-eu-Miguel/reply-card', 'size': '1964'}