{"id":18756137,"url":"https://github.com/nirdosh17/computer-vision-examples","last_synced_at":"2026-05-09T06:02:19.164Z","repository":{"id":208452854,"uuid":"721563958","full_name":"nirdosh17/computer-vision-examples","owner":"nirdosh17","description":"Computer vision examples in python using OpenCV and Dlib.","archived":false,"fork":false,"pushed_at":"2023-11-21T14:40:33.000Z","size":81317,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-11T11:51:20.991Z","etag":null,"topics":["computer-vision","dlib-face-detection","face-detection","face-recognition","opencv","python"],"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/nirdosh17.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-21T10:20:25.000Z","updated_at":"2025-05-20T16:49:46.000Z","dependencies_parsed_at":"2023-11-21T15:54:27.952Z","dependency_job_id":null,"html_url":"https://github.com/nirdosh17/computer-vision-examples","commit_stats":null,"previous_names":["nirdosh17/computer-vision-examples"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nirdosh17/computer-vision-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirdosh17%2Fcomputer-vision-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirdosh17%2Fcomputer-vision-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirdosh17%2Fcomputer-vision-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirdosh17%2Fcomputer-vision-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nirdosh17","download_url":"https://codeload.github.com/nirdosh17/computer-vision-examples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirdosh17%2Fcomputer-vision-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32809147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["computer-vision","dlib-face-detection","face-detection","face-recognition","opencv","python"],"created_at":"2024-11-07T17:35:21.285Z","updated_at":"2026-05-09T06:02:19.149Z","avatar_url":"https://github.com/nirdosh17.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Computer Vision Examples\nComputer vision examples in python using OpenCV and other libraries.\n\nAt the moment, there are working examples only for face detection and face recognition algorithms like OpenCV and Dlib in Python. Object detection will be added later on.\n\n## Installation\nMake sure you have Python3 installed.\n1. Clone the repo and cd to project root directory. We will be running all commands from the root dir.\n\n2. To install dependencies run: `make install`\n\n3. If you run `make help`, it shows list of available commands to run face detection and recognition algorithms on your images.\n\n## Face Detection\n\nIn face detection, we are only interested to identify which parts of the image are human faces.\n\nLibraries like OpenCV and Dlib provide open source classifiers which can be used with minimal configuration. Having said that, we need to tweak the configs to increase or decrease the sensitivity to filter out false positives.\nWe need not to train model for this.\n\nExisting classifiers (HaarCascade, Dlib) are used to get coordinates of bounding box for face and we draw them in the image.\n\n**[HaarCascade](https://docs.opencv.org/4.x/db/d28/tutorial_cascade_classifier.html)**\n- Simple, fast, good for smaller devices.\n- Less accurate than other models like Dlib so needs a bit of fine tuning for correct results.\n- Most used classifiers(face, eyes, cats, license plate) are offered by OpenCV.\n- Good candidate for RaspberryPI as well.\n\nCommands:\n- Run detection in default test image:\n\n  ```bash\n  make haar-detect\n  ``````\n\n  ![Screenshot 2023-11-21 at 7 00 17 PM](https://github.com/nirdosh17/computer-vision-examples/assets/5920689/b60cba38-ce6b-4f8f-8d6b-098d031566db)\n\n- Test on your image:\n  ```bash\n  make haar-detect TEST_IMAGE=\"dataset/test-samples/friends.jpg\"\n  ```\n\n- Run live detection from webcam: `make live-detect`\n\n  ![output](https://github.com/nirdosh17/computer-vision-examples/assets/5920689/e99bd7cb-91f9-4148-b0db-f8f8c275c748)\n\n\n**[Dlib](http://dlib.net)**:\n\n\n- **Face detection using Dlib(HOG + Linear SVM)**\n\n  _Higher accuracy than HaarCascade, still faster than MMOD CNN._\n  ```bash\n  make hog-detect\n  ```\n\n\n- **Face detection using Dlib(MMOD CNN)**\n\n  _Higher accuracy than Dlib HOG, but needs high compute, takes longer time, slower in smaller machines._\n  ```bash\n  make cnn-detect\n  ```\n\n- **Facial Landmark Detection**\n\n  _Detect facial features like eyes, eyebrows, nose, mouth, lips._\n  ```bash\n  make live-facial-landmarks\n  ```\n\n  ![Screenshot 2023-11-21 at 7 43 05 PM](https://github.com/nirdosh17/computer-vision-examples/assets/5920689/d5c3b285-8d7a-41ef-92e8-c4275516a58e)\n\n\n## Face Recognition\n\nFace Recognition has few steps than detection because it is necessary to first detect our faces from the images and label them so that we can identify them later from our test image which will be not included in the training dataset.\n\nIn high level, these are the steps in face recognition using OpenCV:\n- We extract faces using face detection classifiers.\n- Use the facial data and label(e.g. person's name) and train it. What we get is a model which can be saved as a yml file.\n- We then use OpenCV or other face recognizers to predict the label from given input(facial image data).\n- We get label and a confidence score as the result.\n\n### HaarCascade\n\n- Using given classifier, we will be creating a model training it on our images(faces).\n- One image should have one face.\n- Training data set should contain variation of lighting, angles, background for better results.\n\n#### 1. Dataset Preparation\n\nWe need sample images to train for positive and negative values which are inside `dataset/faces` folder.\n\n  For each person, there is a unique folder where the images are kept. Folder name is important here as we use it as **Label** for image when detected.\n  ```\n    .datasets\n    ├── faces\n        ├── Chandler\n        │   ├── 1.png\n        │   ├── 2.png\n        │   ├── ...\n        │   └── 50.png\n        ├── Joey\n        │   ├── 1.png\n        │   ├── 2.png\n        │   ├── ...\n        │   └── 50.png\n        └── Unknown\n            ├── 1.png\n            ├── 2.png\n            ├── ...\n            └── 50.png\n\n  ```\n  Single training image should contain one face only.\n\n#### 2. Train\nRun this command which will apply HaarCascade classifier on our image folders, create a model and save it in yml file.\n\n```bash\nmake haar-train\n```\n\n#### 3. Apply image recognition using the model on our target image\n\n```bash\n# default image\nmake haar-recognize\n# run recognition on your own image\nmake haar-recognize TEST_IMAGE=\"dataset/test-samples/friends.png\"\n```\n\n![Screenshot 2023-11-21 at 7 29 21 PM](https://github.com/nirdosh17/computer-vision-examples/assets/5920689/92e3b17c-a417-42cc-8482-35894693ecf9)\n_It is not 100% accurate. Need to tweak the configs and use with good training dataset._\n\n---\n### References:\n- [OpenCV Python FreeCodeCamp](https://www.youtube.com/watch?v=oXlwWbU8l2o)\n- [Face detection with Dlib](https://pyimagesearch.com/2021/04/19/face-detection-with-dlib-hog-and-cnn/)\n- [Face Recognition with OpenCV](https://pyimagesearch.com/2018/06/18/face-recognition-with-opencv-python-and-deep-learning/)\n- [Face Recognition with Dlib](https://dontrepeatyourself.org/post/face-recognition-with-python-dlib-and-deep-learning/)\n- [Face Recognition with OpenCV](https://pyimagesearch.com/2018/09/24/opencv-face-recognition/)\n- [Face Detection with OpenCV](https://www.datacamp.com/tutorial/face-detection-python-opencv)\n- [Histogram equalization](https://docs.opencv.org/4.x/d5/daf/tutorial_py_histogram_equalization.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirdosh17%2Fcomputer-vision-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnirdosh17%2Fcomputer-vision-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirdosh17%2Fcomputer-vision-examples/lists"}