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 | |
| cap = cv2.VideoCapture(0) | |
| while(True): | |
| ret, frame = cap.read() | |
| cv2.imshow('frame', frame) | |
| if cv2.waitKey(1) & 0xFF == ord('q'): | |
| break | |
| cap.release() | |
| cv2.destroyAllWindows() |
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 | |
| cap = cv2.VideoCapture(0) | |
| while(True): | |
| ret, frame = cap.read() | |
| # Change colorspace: | |
| gray = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY) | |
| cv2.imshow('frame', gray) | |
| if cv2.waitKey(1) & 0xFF == ord('q'): | |
| break |
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 | |
| cap = cv2.VideoCapture(0) | |
| while(True): | |
| ret, frame = cap.read() | |
| # --------CASCADE--------- | |
| # Convert to Greyscale | |
| gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) | |
| # Denoise (also try bluring, this is expensive ) |
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 | |
| # Callback function from trackbar | |
| def onChange(x): | |
| # print(x) | |
| pass | |
| cap = cv2.VideoCapture(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 pygame | |
| from pygame.locals import KEYDOWN, K_ESCAPE | |
| import cv2 as cv | |
| import sys | |
| import numpy as np | |
| cap = cv.VideoCapture(0) | |
| # Native Resolution: | |
| W = cap.get(cv.CAP_PROP_FRAME_WIDTH) | |
| H = cap.get(cv.CAP_PROP_FRAME_HEIGHT) |
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 | |
| import numpy as np | |
| cap = cv2.VideoCapture(0) | |
| while(True): | |
| ret, frame = cap.read() | |
| gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) | |
| gray = cv2.medianBlur(gray, 5) | |
| # Extract regions/pixels of interest |
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 | |
| # -------------- ||| -------------- | |
| array_of_zeroes = np.zeros(10) | |
| # array of 10 zeroes | |
| print(array_of_zeroes) | |
| # >>> [0. 0. 0. 0. 0. 0. 0. 0. 0. 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 numpy as np | |
| linear_spaced_array = np.linspace(0, 60, 5) | |
| print(linear_spaced_array) | |
| # >>> [ 0. 15. 30. 45. 60.] | |
| # What Type ? | |
| print(linear_spaced_array.dtype) | |
| # >>> float64 |
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 | |
| randomNumbers = np.array([0, 15, 30, 45, 60]) | |
| # Append : | |
| randomNumbers = np.append(randomNumbers, [10], axis=0) | |
| # >>> [ 0 15 30 45 60 10] | |
| # Insert: | |
| randomNumbers = np.insert(randomNumbers, 2, 5) |
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 | |
| linear_spaced_array = np.linspace(0, 100, 11, dtype=np.uint8) | |
| # >>> [ 0 10 20 30 40 50 60 70 80 90 100] | |
| # -------------- SIMPLE INDEXING -------------- | |
| firstN = linear_spaced_array[:4] | |
| # >>> [ 0 10 20 30] |