January 5 2026
Creating a automated way to enforce dress code.
Importance
Managing and implementing a dress code at a school or a workplace is not always efficient or just. Studies show that a significant portion of dress code enforcement is not fair, targeting female students and racial minorities. By automizing part of this process bias will decrease and dress code violations will be detected quickly and proficiently.
Part 1
This code initializes a webcam feed and configures background subtraction, noise-cleanup kernels, and thresholds to detect and track motion and color in video frames.
Part 2
This code defines functions to detect and track colored objects by finding bounding boxes, checking overlaps, and creating cleaned color masks from video frames.
Part 3
This code defines the HSV value ranges for different colors to create masks for detecting red, yellow, green, blue, and pink objects.
Part 4
This code continuously captures webcam frames, detects motion, applies a red color mask, finds non-overlapping red objects, and stores them for drawing or tracking.
Part 5
This code detects pink and green objects in each frame, finds their bounding boxes, avoids overlaps with previously detected objects, and stores them for tracking or drawing.
Part 6
This code detects blue and yellow objects in each video frame, finds their bounding boxes, filters out overlaps with previously detected objects, and adds them to the list of detections for tracking or drawing.
Part 7
This code draws rectangles and labels around all detected objects on the video frame, checks if any of the tracked colors (red, pink, green, or yellow) are present, prints a detection message if so, and sets an alert flag accordingly.
Part 8
This code detects moving objects in the webcam feed using background subtraction, isolates each moving region, converts it to grayscale, applies edge detection, counts significant structural patterns, labels the frame if enough patterns are found, draws bounding boxes around the moving objects, and prints alerts.
Part 9
This code displays the color and pattern detection video windows, waits for the user to press "q" to quit, clears the terminal, and then releases the webcam and closes all OpenCV windows to safely terminate the program.
*Terminal prints not shown


*Terminal prints not shown
Video
Videos showing the program in its entirety.
33 seconds
Explains basic workflow of the code.
1 minute 34 seconds
Explains the code more in depth.
1 minute 3 seconds
Shows the product of the code.
The Creator