This file contains 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 | |
img = cv2.imread('shapes.jpg') | |
imgGrey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) | |
_, thrash = cv2.threshold(imgGrey, 240, 255, cv2.THRESH_BINARY) | |
contours, _ = cv2.findContours(thrash, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) | |
cv2.imshow("img", img) | |
for contour in contours: |
This file contains 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 as cv | |
import numpy as np | |
img = cv.imread('sudoku.png',0) | |
_, th1 = cv.threshold(img, 127, 255, cv.THRESH_BINARY) | |
th2 = cv.adaptiveThreshold(img, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY, 11, 2); | |
th3 = cv.adaptiveThreshold(img, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 11, 2); | |
cv.imshow("Image", img) | |
cv.imshow("THRESH_BINARY", th1) |
This file contains 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
def add(x, y=2): | |
return x + y | |
def product(x, y=2): | |
return x * y |
This file contains 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 | |
apple = cv2.imread('apple.jpg') | |
orange = cv2.imread('orange.jpg') | |
print(apple.shape) | |
print(orange.shape) | |
apple_orange = np.hstack((apple[:, :256], orange[:, 256:])) | |
# generate Gaussian pyramid for apple | |
apple_copy = apple.copy() |
This file contains 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 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 | |
from matplotlib import pyplot as plt | |
img = cv2.imread("lena.jpg") | |
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) | |
canny = cv2.Canny(img, 100, 200) | |
titles = ['image', 'canny'] | |
images = [img, canny] |
This file contains 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
$objShell = New-Object -ComObject Shell.Application | |
$objFolder = $objShell.Namespace(0xA) | |
$WinTemp = "c:\Windows\Temp\*" | |
#1# Empty Recycle Bin # | |
write-Host "Emptying Recycle Bin." -ForegroundColor Cyan | |
$objFolder.items() | %{ remove-item $_.path -Recurse -Confirm:$false} | |
#2# Remove Temp |
This file contains 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 | |
from matplotlib import pyplot as plt | |
img = cv.imread("lena.jpg") | |
#img = np.zeros((200,200), np.uint8) | |
#cv.rectangle(img, (0, 100), (200, 200), (255), -1) | |
#cv.rectangle(img, (0, 50), (100, 100), (127), -1) | |
b, g, r = cv.split(img) | |
cv.imshow("img", img) |
This file contains 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
#include <SoftwareSerial.h> // Import Soft Uart library | |
#include <Servo.h> // Import Servo library | |
// Bluetooth communication pins | |
#define TX 2 | |
#define RX 4 | |
// L298N communication pins | |
#define IN1 3 | |
#define IN2 5 |
This file contains 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
def add(x, y): | |
return x + y | |