Created
October 1, 2021 04:59
-
-
Save smith0022/36cafd8e518e4eb00f465059427710f7 to your computer and use it in GitHub Desktop.
for me
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
# Default ignored files | |
/shelf/ | |
/workspace.xml |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="PYTHON_MODULE" version="4"> | |
<component name="NewModuleRootManager"> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> |
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
<component name="InspectionProjectProfileManager"> | |
<settings> | |
<option name="USE_PROJECT_PROFILE" value="false" /> | |
<version value="1.0" /> | |
</settings> | |
</component> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (untitled)" project-jdk-type="Python SDK" /> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/.idea/297b039d09046030d1e89aed9c583834-1699c61a293e186db7f406e8cb38a228ecbfd18e.iml" filepath="$PROJECT_DIR$/.idea/297b039d09046030d1e89aed9c583834-1699c61a293e186db7f406e8cb38a228ecbfd18e.iml" /> | |
</modules> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ChangeListManager"> | |
<list default="true" id="61aad5cd-92f8-47fd-bdb3-2713f1a04553" name="Default Changelist" comment="" /> | |
<option name="SHOW_DIALOG" value="false" /> | |
<option name="HIGHLIGHT_CONFLICTS" value="true" /> | |
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | |
<option name="LAST_RESOLUTION" value="IGNORE" /> | |
</component> | |
<component name="FileTemplateManagerImpl"> | |
<option name="RECENT_TEMPLATES"> | |
<list> | |
<option value="Python Script" /> | |
</list> | |
</option> | |
</component> | |
<component name="ProjectId" id="1xzj6OI9FN4I7HmrNq88iMpZLZ5" /> | |
<component name="ProjectViewState"> | |
<option name="autoscrollToSource" value="true" /> | |
<option name="hideEmptyMiddlePackages" value="true" /> | |
<option name="showLibraryContents" value="true" /> | |
</component> | |
<component name="PropertiesComponent"> | |
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" /> | |
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> | |
<property name="com.intellij.ide.scratch.LRUPopupBuilder$1/New Scratch File" value="csv" /> | |
<property name="last_opened_file_path" value="$USER_HOME$/PycharmProjects/SparkXSmith/venv/lib/python3.8/site-packages/mediapipe/python" /> | |
<property name="settings.editor.selected.configurable" value="preferences.editor" /> | |
</component> | |
<component name="RecentsManager"> | |
<key name="CopyFile.RECENT_KEYS"> | |
<recent name="$USER_HOME$/PycharmProjects/SparkXSmith/venv/lib/python3.8/site-packages/mediapipe/python" /> | |
</key> | |
</component> | |
<component name="RunManager" selected="Python.computer_pratical_for_pratical"> | |
<configuration name="VirtualPainter" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true"> | |
<module name="297b039d09046030d1e89aed9c583834-1699c61a293e186db7f406e8cb38a228ecbfd18e" /> | |
<option name="INTERPRETER_OPTIONS" value="" /> | |
<option name="PARENT_ENVS" value="true" /> | |
<envs> | |
<env name="PYTHONUNBUFFERED" value="1" /> | |
</envs> | |
<option name="SDK_HOME" value="$USER_HOME$/PycharmProjects/SparkXSmith/venv/bin/python" /> | |
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | |
<option name="IS_MODULE_SDK" value="false" /> | |
<option name="ADD_CONTENT_ROOTS" value="true" /> | |
<option name="ADD_SOURCE_ROOTS" value="true" /> | |
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/VirtualPainter.py" /> | |
<option name="PARAMETERS" value="" /> | |
<option name="SHOW_COMMAND_LINE" value="false" /> | |
<option name="EMULATE_TERMINAL" value="false" /> | |
<option name="MODULE_MODE" value="false" /> | |
<option name="REDIRECT_INPUT" value="false" /> | |
<option name="INPUT_FILE" value="" /> | |
<method v="2" /> | |
</configuration> | |
<configuration name="computer_pratical_for_pratical" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> | |
<module name="297b039d09046030d1e89aed9c583834-1699c61a293e186db7f406e8cb38a228ecbfd18e" /> | |
<option name="INTERPRETER_OPTIONS" value="" /> | |
<option name="PARENT_ENVS" value="true" /> | |
<envs> | |
<env name="PYTHONUNBUFFERED" value="1" /> | |
</envs> | |
<option name="SDK_HOME" value="" /> | |
<option name="WORKING_DIRECTORY" value="$APPLICATION_CONFIG_DIR$/scratches" /> | |
<option name="IS_MODULE_SDK" value="false" /> | |
<option name="ADD_CONTENT_ROOTS" value="true" /> | |
<option name="ADD_SOURCE_ROOTS" value="true" /> | |
<option name="SCRIPT_NAME" value="$APPLICATION_CONFIG_DIR$/scratches/computer_pratical_for_pratical.py" /> | |
<option name="PARAMETERS" value="" /> | |
<option name="SHOW_COMMAND_LINE" value="false" /> | |
<option name="EMULATE_TERMINAL" value="false" /> | |
<option name="MODULE_MODE" value="false" /> | |
<option name="REDIRECT_INPUT" value="false" /> | |
<option name="INPUT_FILE" value="" /> | |
<method v="2" /> | |
</configuration> | |
<configuration name="efqergeqrgeg" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> | |
<module name="297b039d09046030d1e89aed9c583834-1699c61a293e186db7f406e8cb38a228ecbfd18e" /> | |
<option name="INTERPRETER_OPTIONS" value="" /> | |
<option name="PARENT_ENVS" value="true" /> | |
<envs> | |
<env name="PYTHONUNBUFFERED" value="1" /> | |
</envs> | |
<option name="SDK_HOME" value="" /> | |
<option name="WORKING_DIRECTORY" value="$APPLICATION_CONFIG_DIR$/scratches" /> | |
<option name="IS_MODULE_SDK" value="false" /> | |
<option name="ADD_CONTENT_ROOTS" value="true" /> | |
<option name="ADD_SOURCE_ROOTS" value="true" /> | |
<option name="SCRIPT_NAME" value="$APPLICATION_CONFIG_DIR$/scratches/efqergeqrgeg.py" /> | |
<option name="PARAMETERS" value="" /> | |
<option name="SHOW_COMMAND_LINE" value="false" /> | |
<option name="EMULATE_TERMINAL" value="false" /> | |
<option name="MODULE_MODE" value="false" /> | |
<option name="REDIRECT_INPUT" value="false" /> | |
<option name="INPUT_FILE" value="" /> | |
<method v="2" /> | |
</configuration> | |
<configuration name="tayyab_send_file" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> | |
<module name="297b039d09046030d1e89aed9c583834-1699c61a293e186db7f406e8cb38a228ecbfd18e" /> | |
<option name="INTERPRETER_OPTIONS" value="" /> | |
<option name="PARENT_ENVS" value="true" /> | |
<envs> | |
<env name="PYTHONUNBUFFERED" value="1" /> | |
</envs> | |
<option name="SDK_HOME" value="$USER_HOME$/PycharmProjects/SparkXSmith/venv/bin/python" /> | |
<option name="WORKING_DIRECTORY" value="$USER_HOME$/PycharmProjects/SparkXSmith/venv/lib/python3.8/site-packages/mediapipe/python" /> | |
<option name="IS_MODULE_SDK" value="false" /> | |
<option name="ADD_CONTENT_ROOTS" value="true" /> | |
<option name="ADD_SOURCE_ROOTS" value="true" /> | |
<option name="SCRIPT_NAME" value="$USER_HOME$/PycharmProjects/SparkXSmith/venv/lib/python3.8/site-packages/mediapipe/python/tayyab_send_file.py" /> | |
<option name="PARAMETERS" value="" /> | |
<option name="SHOW_COMMAND_LINE" value="false" /> | |
<option name="EMULATE_TERMINAL" value="false" /> | |
<option name="MODULE_MODE" value="false" /> | |
<option name="REDIRECT_INPUT" value="false" /> | |
<option name="INPUT_FILE" value="" /> | |
<method v="2" /> | |
</configuration> | |
<configuration name="wewecewdcw" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> | |
<module name="297b039d09046030d1e89aed9c583834-1699c61a293e186db7f406e8cb38a228ecbfd18e" /> | |
<option name="INTERPRETER_OPTIONS" value="" /> | |
<option name="PARENT_ENVS" value="true" /> | |
<envs> | |
<env name="PYTHONUNBUFFERED" value="1" /> | |
</envs> | |
<option name="SDK_HOME" value="$USER_HOME$/PycharmProjects/SparkXSmith/venv/bin/python" /> | |
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | |
<option name="IS_MODULE_SDK" value="false" /> | |
<option name="ADD_CONTENT_ROOTS" value="true" /> | |
<option name="ADD_SOURCE_ROOTS" value="true" /> | |
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/wewecewdcw.py" /> | |
<option name="PARAMETERS" value="" /> | |
<option name="SHOW_COMMAND_LINE" value="false" /> | |
<option name="EMULATE_TERMINAL" value="false" /> | |
<option name="MODULE_MODE" value="false" /> | |
<option name="REDIRECT_INPUT" value="false" /> | |
<option name="INPUT_FILE" value="" /> | |
<method v="2" /> | |
</configuration> | |
<list> | |
<item itemvalue="Python.VirtualPainter" /> | |
<item itemvalue="Python.wewecewdcw" /> | |
<item itemvalue="Python.tayyab_send_file" /> | |
<item itemvalue="Python.efqergeqrgeg" /> | |
<item itemvalue="Python.computer_pratical_for_pratical" /> | |
</list> | |
<recent_temporary> | |
<list> | |
<item itemvalue="Python.computer_pratical_for_pratical" /> | |
<item itemvalue="Python.efqergeqrgeg" /> | |
<item itemvalue="Python.tayyab_send_file" /> | |
<item itemvalue="Python.wewecewdcw" /> | |
</list> | |
</recent_temporary> | |
</component> | |
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> | |
<component name="TaskManager"> | |
<task active="true" id="Default" summary="Default task"> | |
<changelist id="61aad5cd-92f8-47fd-bdb3-2713f1a04553" name="Default Changelist" comment="" /> | |
<created>1631364635187</created> | |
<option name="number" value="Default" /> | |
<option name="presentableId" value="Default" /> | |
<updated>1631364635187</updated> | |
</task> | |
<servers /> | |
</component> | |
<component name="XDebuggerManager"> | |
<breakpoint-manager> | |
<default-breakpoints> | |
<breakpoint type="python-exception"> | |
<properties notifyOnTerminate="true" exception="BaseException"> | |
<option name="notifyOnTerminate" value="true" /> | |
</properties> | |
</breakpoint> | |
</default-breakpoints> | |
</breakpoint-manager> | |
</component> | |
</project> |
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 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 | |
self.trackC = trackC | |
self.mpHands = mp.solutions.hands | |
self.hands = self.mpHands.Hands(self.mode, self.maxhands, self.detectC, self.trackC) | |
self.mpDraw = mp.solutions.drawing_utils | |
self.tipIds = [4, 8, 12, 16, 20] | |
def findhands(self,img,draw = True): | |
Rgb = c.cvtColor(img, c.COLOR_BGR2RGB) | |
self.result = self.hands.process(Rgb) | |
# print(result.multi_hand_landmarks) | |
if self.result.multi_hand_landmarks: | |
for HandsLms in self.result.multi_hand_landmarks: | |
if draw: | |
self.mpDraw.draw_landmarks(img, HandsLms, self.mpHands.HAND_CONNECTIONS) | |
return img | |
def findPosition(self,img,handNo=0,draw=True): | |
self.lmlist = [] | |
if self.result.multi_hand_landmarks: | |
myhand=self.result.multi_hand_landmarks[handNo] | |
for id, lm in enumerate(myhand.landmark): | |
# print(id,lm) | |
h, w, cen = img.shape | |
cx, cy = int(lm.x * w), int(lm.y * h) | |
#print(id, cx, cy) | |
self.lmlist.append([id,cx, cy]) | |
#if id in (4, 8, 16, 12, 20) and draw==True: | |
#c.circle(img, (cx, cy), 15, (255, 0, 255), c.FILLED)return | |
return self.lmlist | |
def FingersUp(self): | |
finger = [] | |
if self.lmlist[self.tipIds[0]][1] < self.lmlist[self.tipIds[0] - 1][1]: | |
finger.append(1) | |
else: | |
finger.append(0) | |
for id in range(1, 5): | |
if self.lmlist[self.tipIds[id]][2] < self.lmlist[self.tipIds[id] - 2][2]: | |
finger.append(1) | |
else: | |
finger.append(0) | |
return finger | |
def main():#to write from this everytime for usuage | |
cap = c.VideoCapture(0) | |
ctime = 0 | |
ptime = 0 | |
HDT=HandDetect() | |
while True: | |
success, img = cap.read() | |
img = HDT.findhands(img,False)#put false fr noy showing the lines | |
HDT.findPosition(img)#false for not shoing dots as well | |
ctime = time.time() | |
fps = 1/(ctime-ptime) | |
ptime = ctime | |
c.putText(img, str(int(fps)), (10, 70), c.FONT_HERSHEY_PLAIN, 3, (255, 0, 0), 3) | |
c.imshow("Image", img) | |
c.waitKey(1) | |
if __name__ == "__main__": | |
main() |
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
�K.�K.�K.�K.�K. |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
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
��$ � smith 1 4567890898765 12/09/2020�.��# �kyle 2 4534637698657 09/06/2069�.�� �tayyab 3 242434665 9/08/2021�.�� �name number salary DOJ�. |
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 | |
import time | |
import os | |
import math | |
import HandsTrackingModule as htm | |
# folderpath = "Da Painter" | |
# mylist = os.listdir(folderpath) | |
# #mylist = mylist[:] | |
# #print(mylist) | |
# overlaylist=[] | |
# drawcolor = (0,0,0) | |
# brushthicc=7 | |
# imgcan=np.zeros((200,200), np.uint8) | |
# xp,yp=0,0 | |
# for imPath in mylist: | |
# image = c.imread(f'{folderpath}/{imPath}') | |
# overlaylist.append(image) | |
# #print(len(overlaylist)) | |
# header = overlaylist[0] | |
# wCam,hCam= 200,200 | |
# cap = c.VideoCapture(0) | |
# cap.set(3,wCam) | |
# cap.set(4,hCam) | |
# detect = htm.HandDetect(detectC=0.85) | |
# while True: | |
# success, img = cap.read() | |
# img = c.flip(img,1) | |
# img=detect.findhands(img,False) | |
# lmlist=detect.findPosition(img,draw=False) | |
# if len(lmlist) != 0: | |
# x1,y1=lmlist[8][1],lmlist[8][2] | |
# x2, y2 = lmlist[12][1], lmlist[12][2] | |
# finger = detect.FingersUp() | |
# length = math.hypot(x2 - x1, y2 - y1) | |
# #print(length) | |
# #print(finger) | |
# if (finger==[0,1,1,0,0] or finger==[1,1,1,0,0]) and length<50: | |
# #c.circle(img, (x1, y1), 20, (0,0,0),c.FILLED) | |
# #c.circle(img, (x2, y2), 20, (0,0,0),c.FILLED) | |
# #print("selectioon mode") | |
# if 90<y1: | |
# header=overlaylist[0] | |
# elif 25<y1<60: | |
# if 200<x1<280: | |
# header=overlaylist[2] | |
# brushthicc = 7 | |
# drawcolor = (255, 0, 0) | |
# elif 28<y1<70: | |
# if 285<x1<333: | |
# brushthicc = 7 | |
# header=overlaylist[3] | |
# drawcolor = (0, 0, 255) | |
# | |
# elif 30<y1<80: | |
# if 360<x1<411: | |
# header=overlaylist[1] | |
# brushthicc = 7 | |
# drawcolor = (0, 255, 255) | |
# if 30<y1<80: | |
# if 444<x1<500: | |
# header = overlaylist[0] | |
# brushthicc=25 | |
# drawcolor=(0,0,0) | |
# #print(drawcolor) | |
# c.rectangle(img, (x1, y1), (x2, y2),drawcolor, c.FILLED) | |
# | |
# if finger==[0,1,0,0,0] or finger==[1,1,0,0,0] : | |
# c.circle(img, (x1, y1), 20, (0,0,0), c.FILLED) | |
# print("drawing mode mode") | |
# if xp==0 and yp==0: | |
# xp,yp=x1,y1 | |
# #c.line(imgcan,(xp,yp),(x1,y1),drawcolor,brushthicc) | |
# c.circle(imgcan, (x1, y1), brushthicc,drawcolor, c.FILLED) | |
# c.line(img,(xp,yp),(x1,y1),drawcolor,brushthicc) | |
# | |
# xp,yp=x1,y1 | |
# # imggray=c.cvtColor(imgcan,c.COLOR_BGR2GRAY) | |
# # _,imgInv=c.threshold(imggray,50,255,c.THRESH_BINARY_INV) | |
# # imgInv=c.cvtColor(imgInv,c.COLOR_GRAY2BGR) | |
# # img = c.bitwise_and(img,imgInv) | |
# # img=c.bitwise_or(img,imgcan) | |
# print(type(img)) | |
# print(type(imgcan)) | |
# print(img) | |
# #img[0:142,0:640] = header | |
# img = c.addWeighted(img,0.5,imgcan,0.5,0) | |
# c.imshow("Image",img) | |
# c.imshow("draw",imgcan) | |
# c.waitKey(1) | |
####################### | |
brushThickness = 25 | |
eraserThickness = 100 | |
######################## | |
# folderPath = "Header" | |
# myList = os.listdir(folderPath) | |
# print(myList) | |
# overlayList = [] | |
# for imPath in myList: | |
# image = cv2.imread(f'{folderPath}/{imPath}') | |
# overlayList.append(image) | |
# print(len(overlayList)) | |
# header = overlayList[0] | |
drawColor = (255, 0, 255) | |
cap = cv2.VideoCapture(1) | |
cap.set(3, 1280) | |
cap.set(4, 720) | |
detector = htm.HandDetect(detectC=0.65) | |
xp, yp = 0, 0 | |
imgCanvas = np.zeros((720, 1280, 3), np.uint8) | |
while True: | |
# 1. Import image | |
success, img = cap.read() | |
img = cv2.flip(img, 1) | |
# 2. Find Hand Landmarks | |
img = detector.findhands(img) | |
lmList = detector.findPosition(img, draw=False) | |
if len(lmList) != 0: | |
# print(lmList) | |
# tip of index and middle fingers | |
x1, y1 = lmList[8][1:] | |
x2, y2 = lmList[12][1:] | |
# 3. Check which fingers are up | |
fingers = detector.FingersUp() | |
# print(fingers) | |
# 4. If Selection Mode - Two finger are up | |
if fingers[1] and fingers[2]: | |
# xp, yp = 0, 0 | |
print("Selection Mode") | |
# # Checking for the click | |
if y1 < 125: | |
if 250 < x1 < 450: | |
#header = overlayList[0] | |
drawColor = (255, 0, 255) | |
elif 550 < x1 < 750: | |
#header = overlayList[1] | |
drawColor = (255, 0, 0) | |
elif 800 < x1 < 950: | |
#header = overlayList[2] | |
drawColor = (0, 255, 0) | |
elif 1050 < x1 < 1200: | |
#header = overlayList[3] | |
drawColor = (0, 0, 0) | |
cv2.rectangle(img, (x1, y1 - 25), (x2, y2 + 25), drawColor, cv2.FILLED) | |
# 5. If Drawing Mode - Index finger is up | |
if fingers[1] and fingers[2] == False: | |
cv2.circle(img, (x1, y1), 15, drawColor, cv2.FILLED) | |
print("Drawing Mode") | |
if xp == 0 and yp == 0: | |
xp, yp = x1, y1 | |
cv2.line(img, (xp, yp), (x1, y1), drawColor, brushThickness) | |
# if drawColor == (0, 0, 0): | |
# cv2.line(img, (xp, yp), (x1, y1), drawColor, eraserThickness) | |
# cv2.line(imgCanvas, (xp, yp), (x1, y1), drawColor, eraserThickness) | |
# | |
# else: | |
# cv2.line(img, (xp, yp), (x1, y1), drawColor, brushThickness) | |
# cv2.line(imgCanvas, (xp, yp), (x1, y1), drawColor, brushThickness) | |
xp, yp = x1, y1 | |
# # Clear Canvas when all fingers are up | |
# if all (x >= 1 for x in fingers): | |
# imgCanvas = np.zeros((720, 1280, 3), np.uint8) | |
imgGray = cv2.cvtColor(imgCanvas, cv2.COLOR_BGR2GRAY) | |
_, imgInv = cv2.threshold(imgGray, 50, 255, cv2.THRESH_BINARY_INV) | |
imgInv = cv2.cvtColor(imgInv,cv2.COLOR_GRAY2BGR) | |
img = cv2.bitwise_and(img,imgInv) | |
img = cv2.bitwise_or(img,imgCanvas) | |
# Setting the header image | |
#img[0:125, 0:1280] = header | |
# img = cv2.addWeighted(img,0.5,imgCanvas,0.5,0) | |
cv2.imshow("Image", img) | |
cv2.imshow("Canvas", imgCanvas) | |
cv2.imshow("Inv", imgInv) | |
cv2.waitKey(1) |
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 pickle as p | |
# def bwrite(): | |
# j = {} | |
# ob = open("data.dat","bw") | |
# for x in range(1,4): | |
# s = input("enter name:") | |
# j[x] = s | |
# p.dump(j,ob) | |
# ob.close() | |
# ob = open("data.dat","br") | |
# k = p.load(ob) | |
# print(k) | |
#............................................................................................. | |
# import pickle as p | |
# def empadd(ob,n): | |
# l = "name\tnumber\tsalary\tDOJ" | |
# p.dump(l,ob) | |
# for x in range(n): | |
# name = input("enter the name :") | |
# number = int(input("enter the number :")) | |
# salary = int(input("enter the salary :")) | |
# DOJ = input("enter the doj :") | |
# l = name + "\t" + str(number) + "\t" + str(salary) + "\t" + DOJ | |
# print(l) | |
# p.dump(l, ob) | |
# ob.close() | |
# ob = open("empdatafor school.csv","rb") | |
# k = p.load(ob) | |
# ob = open("empdatafor school.csv","rb") | |
# #n = int(input("enter the number of employ :")) | |
# #empadd(ob,n) | |
# #ob = open("empdatafor school.csv","rb") | |
# k = p.load(ob) | |
# print(k) | |
# k = p.load(ob) | |
# print(k) | |
# k = p.load(ob) | |
# print(k) | |
# k = p.load(ob) | |
# print(k) | |
# k = p.load(ob) | |
# print(k) | |
# k = p.load(ob) | |
# print(k) | |
# k = p.load(ob) | |
# print(k) | |
# k = p.load(ob) | |
# print(k) | |
# k = p.load(ob) | |
# print(k) | |
#........................................................................... | |
# import pickle as p | |
# def schooladd(ob,n): | |
# l = {} | |
# for x in range(n): | |
# name = input("enter the physics :") | |
# number = int(input("enter the maths :")) | |
# salary = int(input("enter the english :")) | |
# DOJ = input("enter the chemistry :") | |
# l["Physics"] = name | |
# l["maths"] = number | |
# l["englis"] = salary | |
# l["chemistry"] = DOJ | |
# p.dump(l, ob) | |
# ob.close() | |
# ob = open("data_for_school.csv","rb") | |
# k = p.load(ob) | |
# print(k) | |
# ob.close() | |
# ob = open("data_for_school.csv","wb") | |
# n = int(input("enter the number of students :")) | |
# schooladd(ob,n) | |
# ob = open("data_for_school.csv","rb") | |
# k = p.load(ob) | |
# print(k) | |
# k = p.load(ob) | |
# print(k) | |
# k = p.load(ob) | |
# # print(k) | |
#............................................................................................. | |
# import pickle as p | |
# f = open("test.dat","rb") | |
# try: | |
# while True: | |
# s = p.load(f) | |
# print(s) | |
# except EOFError: | |
# f.close() | |
#............................................................................................. | |
# import pickle as p | |
# import cv2 as c | |
# import Han | |
# wCam,hCam= 720,720 | |
# cap = c.VideoCapture(0) | |
# cap.set(3,wCam) | |
# cap.set(4,hCam) | |
# detect = htm.HandDetect(detectC=0.85) | |
# while True: | |
# success, img = cap.read() | |
# img = c.flip(img,1) | |
# img=detect.findhands(img,False) | |
# lmlist=detect.findPosition(img,draw=False) | |
# if len(lmlist) != 0: | |
# if finger == [0, 1, 1, 0, 0] or finger == [1, 1, 1, 0, 0]: | |
# break | |
# else: | |
#............................................................................................... | |
# import pickle | |
# import cv2 as c | |
# import HandsTrackingModule as htm | |
# import math | |
# detect = htm.HandDetect(detectC=0.85) | |
# f = open("test.dat","wb") | |
# cap = c.VideoCapture(0) | |
# while True: | |
# success, img = cap.read() | |
# img = c.flip(img,1) | |
# img=detect.findhands(img) | |
# lmlist=detect.findPosition(img) | |
# if len(lmlist) != 0: | |
# x1, y1 = lmlist[8][1], lmlist[8][2] | |
# x2, y2 = lmlist[12][1], lmlist[12][2] | |
# finger = detect.FingersUp() | |
# length = math.hypot(x2 - x1, y2 - y1) | |
# if (finger == [0, 1, 1, 1, 0] or finger == [1, 1, 1,1, 0]) and length < 50: | |
# c.rectangle(img, (x1, y1), (x2, y2), (0,255,240), c.FILLED) | |
# f.close() | |
# f = open("test.dat","rb") | |
# try: | |
# | |
# while True: | |
# p = pickle.load(f) | |
# print(p) | |
# except: | |
# f.close() | |
# break | |
# if (finger == [0, 1, 0, 0, 0] or finger == [1, 1, 0, 0, 0]) : | |
# s = int(input("enter product code :")) | |
# pickle.dump(s, f) | |
# c.imshow("Image", img) | |
# c.waitKey(1) | |
#........................................................................ | |
import pickle | |
import cv2 as c | |
import HandsTrackingModule as htm | |
import math | |
detect = htm.HandDetect(detectC=0.85) | |
f = open("test12.csv","ab") | |
l = "name\tnumber\tsalary\tDOJ" | |
pickle.dump(l,f) | |
cap = c.VideoCapture(0) | |
print("1 finger for writng " | |
"2 fingers for updating" | |
"3 finger for reading ") | |
while True: | |
success, img = cap.read() | |
img = c.flip(img,1) | |
img=detect.findhands(img) | |
lmlist=detect.findPosition(img) | |
if len(lmlist) != 0: | |
x1, y1 = lmlist[8][1], lmlist[8][2] | |
x2, y2 = lmlist[12][1], lmlist[12][2] | |
finger = detect.FingersUp() | |
length = math.hypot(x2 - x1, y2 - y1) | |
if (finger == [0, 1, 1, 1, 0] or finger == [1, 1, 1,1, 0]) and length < 50: | |
c.rectangle(img, (x1, y1), (x2, y2), (0,255,240), c.FILLED) | |
f.close() | |
f = open("test12.csv","rb") | |
try: | |
while True: | |
p = pickle.load(f) | |
print(p) | |
except: | |
f.close() | |
break | |
if (finger == [0, 1, 0, 0, 0] or finger == [1, 1, 0, 0, 0]) : | |
f.close() | |
f = open("test12.csv", "wb") | |
name = input("enter the name :") | |
number = int(input("enter the number :")) | |
salary = int(input("enter the salary :")) | |
DOJ = input("enter the doj :") | |
l = name + "\t" + str(number) + "\t" + str(salary) + "\t" + DOJ | |
print(l) | |
pickle.dump(l,f) | |
if (finger == [0, 1, 1, 1, 0] or finger == [1, 1, 1, 0, 0]) : | |
f.close() | |
f = open("test12.csv", "wb") | |
name = input("enter the name :") | |
number = int(input("enter the number :")) | |
salary = int(input("enter the salary :")) | |
DOJ = input("enter the doj :") | |
l = name + "\t" + str(number) + "\t" + str(salary) + "\t" + DOJ | |
print(l) | |
pickle.dump(l,f) | |
c.imshow("Image", img) | |
c.waitKey(1) | |
#...................................................................................... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment