{"id":34025147,"url":"https://github.com/roshaan55/pycamdetector","last_synced_at":"2026-04-05T01:34:46.026Z","repository":{"id":57455749,"uuid":"382445457","full_name":"roshaan55/pycamdetector","owner":"roshaan55","description":"Python Package to Detect Face, Hands, Pose, Objects by using webcam or by inputting image","archived":false,"fork":false,"pushed_at":"2023-01-04T07:49:46.000Z","size":12118,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-19T21:19:15.749Z","etag":null,"topics":["facedetection","facelandmarkdetect","handtracking","object-detection"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roshaan55.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-02T19:36:52.000Z","updated_at":"2022-01-22T08:33:38.000Z","dependencies_parsed_at":"2023-02-02T04:02:06.010Z","dependency_job_id":null,"html_url":"https://github.com/roshaan55/pycamdetector","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/roshaan55/pycamdetector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roshaan55%2Fpycamdetector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roshaan55%2Fpycamdetector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roshaan55%2Fpycamdetector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roshaan55%2Fpycamdetector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roshaan55","download_url":"https://codeload.github.com/roshaan55/pycamdetector/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roshaan55%2Fpycamdetector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31421869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T00:25:07.052Z","status":"ssl_error","status_checked_at":"2026-04-05T00:25:05.923Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["facedetection","facelandmarkdetect","handtracking","object-detection"],"created_at":"2025-12-13T16:55:11.283Z","updated_at":"2026-04-05T01:34:46.013Z","avatar_url":"https://github.com/roshaan55.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pycamdetector\nPython package to detect face landmarks(468), detect face, pose estimations, object detection, and least but not last track the hands and also detect its landmarks(21) by using Webcam.\n\nThe Previous version of pycamdetector **pycamdetector 0.5.4** was a reviesd update of previous version **pycamdetector 0.5** which included some additional new fuctions such as **imagesStack**, **cornerRect**, **putRectText** and all the necessary functions used for Computer Vision using **OpenCV Python**.\n\nNew Module **PlotModule** added in new update which is used to plot live graph.\n\nIn **pycamdetector 0.6** some new features are added in Face Detection Module which are: **rectColor**, **rectThick**, **corLen**, **corColor** and **corThick**.\n\n## Installation:\n```nano\npip install pycamdetector\n```\n## For Upgradation(pycamdetector):\n```nano\npip install --upgrade pycamdetector\n```\n\n## Basic Code to open Webcam:\n```py\nimport cv2\n\ncap = cv2.VideoCapture(0)\nwhile True:\n    # Get image frame\n    success, img = cap.read()\n    # Display or open webcam\n    cv2.imshow(\"Image\", img)\n    # press q to close or terminate the while loop\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n```\nIf you have external webcam connected, then you have to pass **1** in **VideoCapture()** function.\n### Code for External Webcam:\n```py\nimport cv2\n\ncap = cv2.VideoCapture(1)\nwhile True:\n    # Get image frame\n    success, img = cap.read()\n    # Display or open webcam\n    cv2.imshow(\"Image\", img)\n    # press q to close or terminate the while loop\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n```\n\n## Additional Functions:\n* imgFlip\n* ImagesStack\n* cornerRect\n* findContours\n* PNGOverlay\n* imageRotate\n* putRectText\n\n## Hand Detection Usage:\n```py\nimport cv2\nimport pycamdetector as pcam\n\ncap = cv2.VideoCapture(0)\ndetector = pcam.HandDetector(minDetConf=0.8, maxHands=2)\nwhile True:\n    # Get image frame\n    success, img = cap.read()\n    # Find the hand and its landmarks\n    hands, img = detector.findHands(img, flipType=False)  # with draw\n    # hands = detector.findHands(img, draw=False)  # without draw\n\n    if hands:\n        # Hand 1\n        hand1 = hands[0]\n        lmList1 = hand1[\"lmList\"]  # List of 21 Landmark points\n        bbox1 = hand1[\"bbox\"]  # Bounding box info x,y,w,h\n        centerPoint1 = hand1['center']  # center of the hand cx,cy\n        handType1 = hand1[\"type\"]  # Handtype Left or Right\n\n        fingers1 = detector.fingersUp(hand1)\n\n        if len(hands) == 2:\n            # Hand 2\n            hand2 = hands[1]\n            lmList2 = hand2[\"lmList\"]  # List of 21 Landmark points\n            bbox2 = hand2[\"bbox\"]  # Bounding box info x,y,w,h\n            centerPoint2 = hand2['center']  # center of the hand cx,cy\n            handType2 = hand2[\"type\"]  # Hand Type \"Left\" or \"Right\"\n\n            fingers2 = detector.fingersUp(hand2)\n\n            # Find Distance between two Landmarks. Could be same hand or different hands\n            length, info, img = detector.findDistance(lmList1[8], lmList2[8], img)  # with draw\n            # length, info = detector.findDistance(lmList1[8], lmList2[8])  # with draw\n    # Display\n    cv2.imshow(\"Image\", img)\n    cv2.waitKey(1)\n```\nThe **Hand Detection Module** contains three methods: **findHands()**, **fingersUp()** and **findDistance()**\nThe **findHands()** takes four optional parameters from user: **drawConns**, **flipType**, **bBox** and **showHandType**\n### 1. drawConns:\nIts a boolean value which takes the input as **true** or **false**, is used to draw the hand connections of hands detected in a BGR Image or by webcam input.\nBy default it is true and draws the hand connections.\nIf you don't want to draw the hand connectins on hand, you can pass draw as **False**.\n\n**Note**: By default the drawConns takes two parameters: **hands** and **img** with **drawConns=True**. If you pass only **one parameter** with **drawConns=True** it will generate an error. Similarly **drawConns=False** takes only one parameter **hands**, if you pass **hands** with **img** it will also generate an error. You have to follow the sequence as given or mentioned below.\n\nWith **drawConns=True**\n```py\nhands, img = detector.findHands(img)\n```\nWith **drawConns=False**\n```py\nhands = detector.findHands(img, drawConns=False)\n```\n### 2. flipType:\nIts a boolean value which takes the input as **true** or **false**, is used to draw flip the type of hands detected in a BGR Image or by webcam input.\nBy default it is true and flips the hand type. If you don't want to flip the type of hand, you can pass flipType as **False**.\n\nWith **drawConns=True** and **flipType=False**\n```py\nhands, img = detector.findHands(img, fliptype=False)\n```\nWith **drawConns=False** and **flipType=False**\n```py\nhands = detector.findHands(img, drawConns=False, fliptype=False)\n```\n### 3. bBox:\nIts a boolean value which takes the input as **true** or **false**, is used to draw the bounding box around the hand detected in a BGR Image or by webcam input.\nBy default it is **false**. If you want to draw the bounding box around the hand detected, you can pass bBox as **True**.\n\nWith **drawConns=True** and **bBox=True**\n```py\nhands, img = detector.findHands(img, bBox=True)\n```\nWith **drawConns=False** and **bBox=True**\n```py\nhands = detector.findHands(img, drawConns=False, bBox=True)\n```\n### 4. showHandType:\nIts a boolean value which takes the input as **true** or **false**, is used to show the type of hand detected in a BGR Image or by webcam input.\nBy default it is **false**. If you want to show the hand type of hand detected, you can pass showHandType as **True**.\n\nWith **drawConns=True** and **showHandType=True**\n```py\nhands, img = detector.findHands(img, showHandype=True)\n```\nWith **drawConns=False** and **showHandType=True**\n```py\nhands = detector.findHands(img, drawConns=False, showHandype=True)\n```\nThe **fingersUp()** takes one parameter from user: **myHand**\nThe **findDistance()** takes two parameters from user: **p1** and **p2**\n\n## Face Detection Usage:\n```py\nimport cv2\nfrom pycamdetector.FaceDetectionModule import FaceDetector\n\ncap = cv2.VideoCapture(0)\ndetector = FaceDetector(minDetConf=0.85)\nwhile True:\n    success, img = cap.read()\n    img = cv2.cv2.flip(img, 1)\n    img, bboxs = detector.findFaces(img, showPerc=False)\n    print(bboxs)\n    cv2.imshow('Image', img)\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n```\nIn the **Face Detecion Module** the funtion of **findFaces()** takes three optional parameters from user: **drawRect**, **showPercentage**, and **textColor**.\nNew Features are added in new update of pycamdetector as mentioned above in the description.\nIn new update **pycamdetector 0.6** the parameter **showPercentage** changed to **showPerc**.\n### 1. drawRect:\nIts a boolean value which takes the input as **true** or **false**, is used to draw the rectangle around the faces detected in a BGR Image or by webcam input.\nBy default it is true and draws the rectangle around the faces. If you don't want to draw rectangle around the faces detected, follow the below code:\n```py\nimport cv2\nfrom pycamdetector.FaceDetectionModule import FaceDetector\n\ncap = cv2.VideoCapture(0)\ndetector = FaceDetector(minDetConf=0.85)\nwhile True:\n    success, img = cap.read()\n    img = cv2.cv2.flip(img, 1)\n    img, bboxs = detector.findFaces(img, drawRect=False)\n    print(bboxs)\n    cv2.imshow('Image', img)\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n```\n### 2. showPerc:\nIts a boolean value which takes the input as **true** or **false**, is used to display the accuracy percentage of the faces detected in a BGR Image or by webcam input.\nBy default it is true and displays the accuracy percentage of the faces detected. If you don't want to display percentage, follow the below code:\n```py\nimport cv2\nfrom pycamdetector.FaceDetectionModule import FaceDetector\n\ncap = cv2.VideoCapture(0)\ndetector = FaceDetector(minDetConf=0.85)\nwhile True:\n    success, img = cap.read()\n    img = cv2.cv2.flip(img, 1)\n    img, bboxs = detector.findFaces(img, showPerc=False)\n    print(bboxs)\n    cv2.imshow('Image', img)\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n```\n### 3. textColor:\nIt is a color of text used to display accuracy percentage.\nBy default the color of text is White(255, 255, 255). These are the BGR values and always accepts BGR(Blue, Green, Red) values. If you want to change the color simply follow the below code:\n```py\nimport cv2\nfrom pycamdetector.FaceDetectionModule import FaceDetector\n\ncap = cv2.VideoCapture(0)\ndetector = FaceDetector(minDetConf=0.85)\nwhile True:\n    success, img = cap.read()\n    img = cv2.cv2.flip(img, 1)\n    img, bboxs = detector.findFaces(img, textColor=(255,255,255))\n    print(bboxs)\n    cv2.imshow('Image', img)\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n```\n### 4. rectColor:\nIt is a color of rectangle around the faces detected.\nBy default the color of rectangle is White(255, 255, 255). These are the BGR values and always accepts BGR(Blue, Green, Red) values. If you want to change the color simply follow the below code:\n```py\nimport cv2\nfrom pycamdetector.FaceDetectionModule import FaceDetector\n\ncap = cv2.VideoCapture(0)\ndetector = FaceDetector(minDetConf=0.85)\nwhile True:\n    success, img = cap.read()\n    img = cv2.cv2.flip(img, 1)\n    img, bboxs = detector.findFaces(img, rectColor=(0, 255, 0))\n    print(bboxs)\n    cv2.imshow('Image', img)\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n```\n### 5. rectThick:\nIt is the thickness of rectangle around the faces detected.\nBy default its thickness is 1. If you want to increase or decrease the thickness, simply follow the below code:\n```py\nimport cv2\nfrom pycamdetector.FaceDetectionModule import FaceDetector\n\ncap = cv2.VideoCapture(0)\ndetector = FaceDetector(minDetConf=0.85)\nwhile True:\n    success, img = cap.read()\n    img = cv2.cv2.flip(img, 1)\n    img, bboxs = detector.findFaces(img, rectThick=2)\n    print(bboxs)\n    cv2.imshow('Image', img)\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n```\n### 6. corLen:\nIt is the length of corner lines of rectangle around the faces detected.\nBy default its length is 30. If you want to increase or decrease the length, simply follow the below code:\n```py\nimport cv2\nfrom pycamdetector.FaceDetectionModule import FaceDetector\n\ncap = cv2.VideoCapture(0)\ndetector = FaceDetector(minDetConf=0.85)\nwhile True:\n    success, img = cap.read()\n    img = cv2.cv2.flip(img, 1)\n    img, bboxs = detector.findFaces(img, corLen=20)\n    print(bboxs)\n    cv2.imshow('Image', img)\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n```\n### 7. corColor:\nIt is the color of corner lines of rectangle around the faces detected.\nBy default the color of corners are Pink(255, 0, 255). These are the BGR values and always accepts BGR(Blue, Green, Red) values. If you want to change the color simply follow the below code:\n```py\nimport cv2\nfrom pycamdetector.FaceDetectionModule import FaceDetector\n\ncap = cv2.VideoCapture(0)\ndetector = FaceDetector(minDetConf=0.85)\nwhile True:\n    success, img = cap.read()\n    img = cv2.cv2.flip(img, 1)\n    img, bboxs = detector.findFaces(img, corColor=(0, 0, 255))\n    print(bboxs)\n    cv2.imshow('Image', img)\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n```\n### 8. corThick:\nIt is the Thickness of the corners of rectangle around the faces detected.\nBy default the thickness of corners are 2. If you want to change the color simply follow the below code:\n```py\nimport cv2\nfrom pycamdetector.FaceDetectionModule import FaceDetector\n\ncap = cv2.VideoCapture(0)\ndetector = FaceDetector(minDetConf=0.85)\nwhile True:\n    success, img = cap.read()\n    img = cv2.cv2.flip(img, 1)\n    img, bboxs = detector.findFaces(img, corThick=3)\n    print(bboxs)\n    cv2.imshow('Image', img)\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n```\n\n## FPS Usage\n```py\nimport cv2\nfrom FPS import FPS\n# import time # import time module when you don't want webcam\n\n# \"\"\"\n# Without Webcam\n# \"\"\"\n# fpsReader = FPS()\n# while True:\n#     time.sleep(0.025)  # add delay to get 40 Frames per second\n#     fps = fpsReader.showFPS()\n#     print(fps)\n\n\"\"\"\nWith Webcam\n\"\"\"\nFPSReader = FPS()\ncap = cv2.VideoCapture(0)\nwhile True:\n    success, img = cap.read()\n    fps, img = FPSReader.showFPS(img)\n    cv2.imshow(\"Image\", img)\n    cv2.waitKey(1)\n```\n\n## Images Stack usage\n```py\nimport cv2\nfrom FPS import FPS\n# import time # import time module when you don't want webcam\n\n# \"\"\"\n# Without Webcam\n# \"\"\"\n# fpsReader = FPS()\n# while True:\n#     time.sleep(0.025)  # add delay to get 40 Frames per second\n#     fps = fpsReader.showFPS()\n#     print(fps)\n\n\"\"\"\nWith Webcam\n\"\"\"\nFPSReader = FPS()\ncap = cv2.VideoCapture(0)\nwhile True:\n    success, img = cap.read()\n    fps, img = FPSReader.showFPS(img)\n    cv2.imshow(\"Image\", img)\n    cv2.waitKey(1)\n```\n\n## Object Detection Usage:\n```py\nimport cv2\nimport time\nimport pycamdetector\n\ncap = cv2.VideoCapture(0)\ncap.set(3, 640)\ncap.set(4, 480)\n\n\n# Download these necessary files from this repository\n\nconfigpath = 'ssd_mobilenet_v3_large_coco_2020_01_14.pbtxt'\nweightpath = 'frozen_inference_graph.pb'\nlabelsPath = 'coco.names'\n\ndetector = pycamdetector.ObjectDetector(weightpath, configpath, labelsPath)\n\nwhile True:\n    success, img = cap.read()\n    img, indices = detector.DetectObject(img)\n    print(indices)\n    cv2.imshow(\"Output\", img)\n    cv2.waitKey(1)\n```\n\n## Images Stack usage\n```py\nimport pycamdetector\nimport cv2\n\ncap = cv2.VideoCapture(0)\ncap.set(3, 1280)\ncap.set(4, 720)\n\nwhile True:\n    success, img = cap.read()\n    imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n    imgList = [img, img, imgGray, img, imgGray, img,imgGray, img, img]\n    stackedImg = pycamdetector.imagesStack(imgList, 3, 0.4)\n    cv2.imshow(\"stacked Images\", stackedImg)\n    # press q to close or terminate the while loop\n    if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n        break\n\n```\n\nFor more examples see [Examples](https://github.com/roshaan55/pycamdetector/blob/main/examples \"Examples of funcions of pydetector\").\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froshaan55%2Fpycamdetector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froshaan55%2Fpycamdetector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froshaan55%2Fpycamdetector/lists"}