<jupyter_start><jupyter_text>Road Traffic and Computer Vision. Keeping in mind this pipeline is not efficient and is not necessarily the best way to do this. It's just to demonstrate how the technology works and why it is an easy to implement and inexpensive to maintain technology. The over-arching goal is to use a R-CNN to extract the license plates specifically from vehicles.  This can be used to give:1. vehicle type;2. if the vehicle is stolen;3. Origin destination of the vehicle (if there were a network of cameras throughout the city);4. Your usual counts and speed etc. There's some research that explores this that I'm looking into replicating.  Key understanding is.- Video detection:    -  Images(Frames) are matrices with 3 dimensions made up of RGB(and Alpha) and with numbers between 0-255 for each pixel location.     - Filtering these matrices to extract valuable information(features) lets us do traffic counts.     - Variety of methods available and lots of tutorials online to achieve this goal. - Some of the filters here are: Threshold, Erode, Dilate, Opening, Closing.     - Threshold - If pixel value is greater than a threshold value, it is assigned one value (may be white), else it is assigned another value (may be black).     - Erode -  erodes away the boundaries of foreground object.    - Dilate - Opposite of erosion. Here, a pixel element is '1' if atleast one pixel under the kernel is '1'. So it increases the white region in the image or size of foreground object increases.    - Opening - Another name of erosion followed by dilation.    - Closing - The reverse of Opening, Dilation followed by Erosion. - After this you find contours .    - Contours can be explained simply as a curve joining all the continuous points (along the boundary), having same color or intensity. The contours are a useful tool for shape analysis and object detection and recognition.  Example of filtering<jupyter_code>import cv2
import numpy as np
import os
video = "input.mp4"
cap = cv2.VideoCapture(video)
subtractor = cv2.createBackgroundSubtractorMOG2(history=100, varThreshold=50, detectShadows=True)
while True:
    _, frame = cap.read()
    mask = subtractor.apply(frame) 
    cv2.imshow("Frame", frame)
    cv2.imshow("mask", mask)
    key = cv2.waitKey(30)
    if key == 27:
        break
cap.release()
cv2.destroyAllWindows()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0600083927822073, 'fraction_numerical': 0.012169534200587495, 'mean_word_length': 3.9979035639413, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '410336', 'license': 'MIT', 'n_tokens_mistral': 641, 'n_tokens_neox': 595, 'n_words': 328, 'path': 'notebooks/Road Traffic and Computer Vision Exploration.ipynb', 'repo_name': 'Hewlbern/DataExploration', 'size': '2383'}