Skip to content

Instantly share code, notes, and snippets.

@ECHO OFF
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDPrivate
:CONFIRM
echo Are you sure to lock this folder? (Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
@pknowledge
pknowledge / probabilistic_hough_line_transform_opencv_python.py
Created August 2, 2019 22:49
Probabilistic Hough Transform opencv python
import cv2
import numpy as np
img = cv2.imread('road.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray,50,150,apertureSize = 3)
cv2.imshow('edges', edges)
lines = cv2.HoughLinesP(edges,1,np.pi/180,100,minLineLength=100,maxLineGap=10)
for line in lines:
x1,y1,x2,y2 = line[0]
cv2.line(img,(x1,y1),(x2,y2),(0,255,0),2)
@pknowledge
pknowledge / docker-compose.yaml
Created February 26, 2024 16:36
Run Microsoft Azure SQL Edge using docker compose
version: '3.8'
services:
sql:
image: mcr.microsoft.com/azure-sql-edge
container_name: sql
ports:
- "1433:1433"
environment:
ACCEPT_EULA: "1"
@pknowledge
pknowledge / basic_motion_detection_opencv_python.py
Created June 25, 2019 18:11
Motion Detection and Tracking Using Opencv Contours
import cv2
import numpy as np
cap = cv2.VideoCapture('vtest.avi')
frame_width = int( cap.get(cv2.CAP_PROP_FRAME_WIDTH))
frame_height =int( cap.get( cv2.CAP_PROP_FRAME_HEIGHT))
fourcc = cv2.VideoWriter_fourcc('X','V','I','D')
@pknowledge
pknowledge / template_matching_opencv_python.py
Created July 19, 2019 19:33
Template matching using OpenCV in Python
import cv2
import numpy as np
img = cv2.imread("messi5.jpg")
grey_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
template = cv2.imread("messi_face.jpg", 0)
w, h = template.shape[::-1]
res = cv2.matchTemplate(grey_img, template, cv2.TM_CCORR_NORMED )
print(res)
threshold = 0.99;
@pknowledge
pknowledge / face_detection.py
Created September 4, 2019 23:22
Face Detection in using OpenCV & Python with Face Detection using Haar Cascades
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 / hough_line_transform_opencv_python.py
Created July 31, 2019 22:17
Hough Line Transform opencv python
import cv2
import numpy as np
img = cv2.imread('sudoku.png')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray, 50, 150, apertureSize=3)
cv2.imshow('edges', edges)
lines = cv2.HoughLines(edges, 1, np.pi / 180, 200)
for line in lines:
@pknowledge
pknowledge / detector.py
Created August 31, 2019 15:24
OpenCV Python Tutorial For Beginners - Road Lane Line Detection with OpenCV (Part 3)
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 / main.c
Created May 29, 2021 09:18
Arduino Tutorial for Beginners – LED Matrix With Arduino
#define ROW_1 2
#define ROW_2 3
#define ROW_3 4
#define ROW_4 5
#define ROW_5 6
#define ROW_6 7
#define ROW_7 8
#define ROW_8 9
#define COL_1 10
@pknowledge
pknowledge / detector.py
Created August 22, 2019 20:14
Road Lane Line Detection with OpenCV
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]