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 / main.cpp
Created Feb 12, 2020
Arduino Project: Arduino Real Time Clock (RTC) with Temperature Monitor
View main.cpp
#include <Wire.h>
#include <DS3231.h>
#include <LiquidCrystal_I2C.h>
DS3231 rtc(SDA, SCL);
LiquidCrystal_I2C lcd(0x3F, 16, 2);
#define Toggle_Up 4
#define Set_time 2
#define Set_date 3
@pknowledge
pknowledge / Selection_Sort.py
Created Jan 8, 2020
Python Selection Sort Algorithm | Python Data Structures and Algorithms
View Selection_Sort.py
l=[2,23,14,11,32,39,7]
def selectionSort(arr):
for i in range(len(arr)):
cur_max=0
for j in range(1,len(arr)-i):
if arr[cur_max]<arr[j]:
cur_max=j
arr[len(arr)-1-i],arr[cur_max]=arr[cur_max],arr[len(arr)-1-i]
print(l)
@pknowledge
pknowledge / Python_BubbleSort.py
Created Jan 8, 2020
Python BubbleSort Sorting Algorithm | Python Data Structures and Algorithms
View Python_BubbleSort.py
a=[2,23,14,7,32,39]
def bubbleSort(arr):
n=len(arr)
for i in range(n):
for j in range(n-1-i):
if arr[j]>arr[j+1]:
arr[j],arr[j+1]=arr[j+1],arr[j]
print(arr)
@pknowledge
pknowledge / Camshift_in_OpenCV.py
Created Jan 1, 2020
OpenCV Python Tutorial For Beginners - Object Tracking Camshift Method
View Camshift_in_OpenCV.py
import numpy as np
import cv2 as cv
cap = cv.VideoCapture('slow_traffic_small.mp4')
# take first frame of the video
ret, frame = cap.read()
# setup initial location of window
x, y, width, height = 300, 200, 100, 50
track_window = (x, y ,width, height)
# set up the ROI for tracking
roi = frame[y:y+height, x : x+width]
@pknowledge
pknowledge / meanshift_in_OpenCV.py
Created Dec 17, 2019
Mean Shift Object Tracking in opencv python
View meanshift_in_OpenCV.py
import numpy as np
import cv2 as cv
cap = cv.VideoCapture('slow_traffic_small.mp4')
# take first frame of the video
ret, frame = cap.read()
# setup initial location of window
x, y, width, height = 300, 200, 100, 50
track_window = (x, y ,width, height)
# set up the ROI for tracking
roi = frame[y:y+height, x : x+width]
@pknowledge
pknowledge / main.cpp
Created Dec 14, 2019
How to create WEATHER BOX USING ARDUINO using DHT22 Temperature and Humidity Sensor
View main.cpp
#include "DHT.h"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Define button pins
#define Toggle_Up 2
#define Maxdisplay 3
#define Set 4
// Define led pins
@pknowledge
pknowledge / opencv_Background_Subtraction.py
Created Dec 9, 2019
How to Use Background Subtraction Methods in Python Opencv
View opencv_Background_Subtraction.py
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()
@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)
You can’t perform that action at this time.