Skip to content

Instantly share code, notes, and snippets.

pknowledge

Block or report user

Report or block pknowledge

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pknowledge
pknowledge / Autobin.cpp
Created Oct 28, 2019
Arduino smart Dustbin
View Autobin.cpp
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;
View Shi_Tomasi_Corner_Detector_OpenCV.py
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)
View Harris_Corner_Detector_in_OpenCV.py
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)
@pknowledge
pknowledge / text_file_to_speech.py
Created Sep 10, 2019
TEXT TO SPEECH IN PYTHON | Convert Text to Speech in Python
View text_file_to_speech.py
# 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", " ")
@pknowledge
pknowledge / eye_detection.py
Created Sep 7, 2019
OpenCV Python Tutorial For Beginners - Eye Detection Haar Feature based Cascade Classifiers f
View eye_detection.py
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)
@pknowledge
pknowledge / face_detection.py
Created Sep 4, 2019
Face Detection in using OpenCV & Python with Face Detection using Haar Cascades
View face_detection.py
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()
@pknowledge
pknowledge / detecting_circles_using_hough_circle_transform.py
Created Sep 3, 2019
Circle Detection using OpenCV Hough Circle Transform
View detecting_circles_using_hough_circle_transform.py
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, :]:
@pknowledge
pknowledge / detector.py
Created Aug 31, 2019
OpenCV Python Tutorial For Beginners - Road Lane Line Detection with OpenCV (Part 3)
View detector.py
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)
@pknowledge
pknowledge / detector.py
Created Aug 25, 2019
OpenCV Python Tutorial For Beginners - Road Lane Line Detection with OpenCV (Part 2)
View detector.py
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)
@pknowledge
pknowledge / detector.py
Created Aug 22, 2019
Road Lane Line Detection with OpenCV
View detector.py
import matplotlib.pylab as plt
import cv2
import numpy as np
image = cv2.imread('road.jpg')
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
print(image.shape)
height = image.shape[0]
width = image.shape[1]
You can’t perform that action at this time.