Skip to content

Instantly share code, notes, and snippets.

View smith0022's full-sized avatar
🎯
Focusing

smith0022

🎯
Focusing
View GitHub Profile
import cv2
from picamera2 import Picamera2
# Grab images as numpy arrays and leave everything else to OpenCV.
face_detector = cv2.CascadeClassifier("/usr/share/opencv4/haarcascades/haarcascade_frontalface_default.xml")
cv2.startWindowThread()
picam2 = Picamera2()
import cv2 as cv2
import numpy as np
import math as m
from picamera2 import Picamera2
cap = Picamera2()
cap.configure(cap.create_preview_configuration(main={"format": 'XRGB8888', "size": (640, 480)}))
cap.start()
while True:
img = cap.capture_array()
detect=cv2.QRCodeDetector()
import cv2
# define a video capture object
vid = cv2.VideoCapture(0)
while(True):
# Capture the video frame
# by frame
@smith0022
smith0022 / welcome.kv
Created March 13, 2022 12:51
.kv file for the kivy_sample_app01
#: import NoTransition kivy.uix.screenmanager.NoTransition
<Login_Page>:
name : "Login_Page"
MDScreen:
MDToolbar:
title : "Courier Service System"
pos_hint : {"top":1}
Image :
source : "courier_design(256256).png"
pos_hint : {'center_x':0.5,'center_y':0.7}
@smith0022
smith0022 / Kivy_sample_app01.py
Created March 13, 2022 12:50
sample for kivy
from kivymd.app import MDApp
from kivy.uix.screenmanager import ScreenManager, Screen, NoTransition
from kivy.lang import Builder
from kivymd.uix.datatables import MDDataTable
from kivy.metrics import dp
from kivy.uix.anchorlayout import AnchorLayout
from kivy.properties import ObjectProperty
from kivymd.uix.screen import MDScreen
Builder.load_file("welcome.kv")
"""Write a program that rotates the elements of a list so that the element at
the first index moves to the second index, the element in the second
index moves to the third index, etc., and the element at the last moves to
the first index."""
"question 9"
# def lower_case():
# ob = open("/Users/mahantsmith/Library/Application Support/JetBrains/PyCharmCE2020.3/scratches/file14fun.txt")
# fb = open("lower_file14fun.txt","w")
# j = ob.readlines()
# for x in j:
@smith0022
smith0022 / virtual_painter.py
Created September 6, 2021 18:23
use it you will get it
import cv2 as c
import numpy as np
import time
import os
import math
import HandsTrackingModule as htm
folderpath = "/home/smith/Da Painter"
mylist = os.listdir(folderpath)
mylist = mylist[:-1]
#print(mylist)
@smith0022
smith0022 / GestureVolumeControl.py
Created August 12, 2021 11:24
It's a volume control using handsfor linux for using it you need HandTrackingModule
import numpy as np
import math
from random import randint as rn
import HandsTrackingModule as hdt
import cv2 as c
import time
from subprocess import call
#from ctypes import cast, POINTER
#rom comtypes import CLSCTX_ALL
#from pycaw.pycaw import AudioUtilities, IAudioEndpointVolume
@smith0022
smith0022 / HandsTrackingModule.py
Created August 12, 2021 11:22
a module for tracking and can be used for various other purposes
import cv2 as c
import mediapipe as mp
import time
class HandDetect() :
def __init__(self, mode=False, maxhands=2, detectC=0.5, trackC=0.5):
self.mode = mode
self.maxhands = maxhands
self.detectC = detectC