<jupyter_start><jupyter_text>Chroma Cinematography  To create an application which will display image in background where chorma is placed  Importing Important libraries<jupyter_code>import numpy as np  # for processing tensors
import cv2          # for processing image<jupyter_output><empty_output><jupyter_text>Tiny program to nail the application ;-)<jupyter_code># Initiallizing the Camera to start Video Capturing
cap = cv2.VideoCapture(0)
# Placing the upper bound and lower bound of chroma in hsv
lb=np.array([190,190,190])
ub=np.array([255,255,255])
count=0
list_of_img = ['img.jpg','img1.jpg','img2.png','img3.jpg','img4.jpg','img5.jpg','space.jpg']
# kernel for performing the mrophological operation on the frames
kernel = np.ones((3,3),np.uint8)

while True:
    # reading the image from the camera instance
    ret, frame = cap.read()
    # Reducing the noise, doing meadian bluring
    frame = cv2.medianBlur(frame,3)
    # Converting bgr color fromat to HSV format
    hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
    # Masking image between upper bounds and lower bounds
    closing = cv2.inRange(hsv,lb,ub)
    # Appling Morphological operation to reduce noise
    closing = cv2.morphologyEx(closing, cv2.MORPH_OPEN, kernel,iterations=1)
    
    # providing final input in canvas by combining frame and image
    canvas = frame.copy()
    canvas[closing != 0] =[0,0,0]
    img = cv2.imread(list_of_img[count])
    img = cv2.resize(img, (640,480))
    img[closing == 0]= [0,0,0]
    
    # showing the final frame after combining both frame
    final = canvas+img
    #cv2.imshow('Capture', frame)
    cv2.imshow('final',final)
    # inturrupt in while loop.
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
    elif cv2.waitKey(1) & 0xFF == ord('f'):
        if count<len(list_of_img)-1:
            count=count+1
            img = list_of_img[count]
        else:
            count=0
    elif cv2.waitKey(1) & 0xFF == ord('b'):
        if count>1:
            count=count-1
            img = list_of_img[count]
        else:
            count = len(list_of_img)-1
# releasing the camera input
cap.release()
# destroing all windows created by cv2
cv2.destroyAllWindows()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1096136567834681, 'fraction_numerical': 0.03324348607367475, 'mean_word_length': 3.4186507936507935, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '435922', 'license': 'MIT', 'n_tokens_mistral': 768, 'n_tokens_neox': 732, 'n_words': 202, 'path': 'Cromatica.ipynb', 'repo_name': 'ShantanuShinde/Chromatica', 'size': '2226'}