This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import cv2 as cv | |
| cap = cv.VideoCapture('vtest.avi') | |
| #kernel = cv.getStructuringElement(cv.MORPH_ELLIPSE, (3,3)) | |
| fgbg = cv.bgsegm.createBackgroundSubtractorMOG() | |
| #fgbg = cv.bgsegm.BackgroundSubtractorGMG() | |
| #fgbg = cv.createBackgroundSubtractorMOG2(detectShadows=True) | |
| #fgbg = cv.createBackgroundSubtractorKNN(detectShadows=True) | |
| while True: | |
| ret, frame = cap.read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dd/// | |
| /// | |
| /// NOTICE: We SHOULD supply 5.0 Voltage to SERVO run stably | |
| /// | |
| /// | |
| #include <Servo.h> //servo library | |
| Servo servo; | |
| int trigPin = 5; | |
| int echoPin = 6; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import cv2 as cv | |
| img = cv.imread('pic1.png') | |
| gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) | |
| corners = cv.goodFeaturesToTrack(gray, 100, 0.01, 10) | |
| corners = np.int0(corners) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import cv2 as cv | |
| img = cv.imread('chessboard_img.png') | |
| cv.imshow('img', img) | |
| gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) | |
| gray = np.float32(gray) | |
| dst = cv.cornerHarris(gray, 2, 3, 0.04) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import the Gtts module for text | |
| # to speech conversion | |
| from gtts import gTTS | |
| # import Os module to start the audio file | |
| import os | |
| fh = open("test.txt", "r") | |
| myText = fh.read().replace("\n", " ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cv2 | |
| face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') | |
| eye_cascade = cv2.CascadeClassifier('haarcascade_eye_tree_eyeglasses.xml') | |
| cap = cv2.VideoCapture('test.mp4') | |
| while cap.isOpened(): | |
| _, img = cap.read() | |
| gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) | |
| faces = face_cascade.detectMultiScale(gray, 1.1, 4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cv2 | |
| face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') | |
| # Read the input image | |
| #img = cv2.imread('test.png') | |
| cap = cv2.VideoCapture('test.mp4') | |
| while cap.isOpened(): | |
| _, img = cap.read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import cv2 as cv | |
| img = cv.imread('smarties.png') | |
| output = img.copy() | |
| gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) | |
| gray = cv.medianBlur(gray, 5) | |
| circles = cv.HoughCircles(gray, cv.HOUGH_GRADIENT, 1, 20, | |
| param1=50, param2=30, minRadius=0, maxRadius=0) | |
| detected_circles = np.uint16(np.around(circles)) | |
| for (x, y ,r) in detected_circles[0, :]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pylab as plt | |
| import cv2 | |
| import numpy as np | |
| def region_of_interest(img, vertices): | |
| mask = np.zeros_like(img) | |
| #channel_count = img.shape[2] | |
| match_mask_color = 255 | |
| cv2.fillPoly(mask, vertices, match_mask_color) | |
| masked_image = cv2.bitwise_and(img, mask) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pylab as plt | |
| import cv2 | |
| import numpy as np | |
| def region_of_interest(img, vertices): | |
| mask = np.zeros_like(img) | |
| #channel_count = img.shape[2] | |
| match_mask_color = 255 | |
| cv2.fillPoly(mask, vertices, match_mask_color) | |
| masked_image = cv2.bitwise_and(img, mask) |