{"id":24576132,"url":"https://github.com/rowlkh/skin-detection","last_synced_at":"2026-05-19T17:11:25.408Z","repository":{"id":272843068,"uuid":"910869112","full_name":"Rowlkh/Skin-Detection","owner":"Rowlkh","description":"A skin detection system using image processing and machine learning to classify pixels as skin or non-skin. Implements Python, OpenCV, and algorithms like Logistic Regression and Random Forest for segmentation and classification. ","archived":false,"fork":false,"pushed_at":"2025-01-16T23:09:18.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T00:19:55.638Z","etag":null,"topics":["classification","deep-learning","image-processing","image-segmentation","machine-learning","opencv","python","skin-detection"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rowlkh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-01T17:20:56.000Z","updated_at":"2025-01-16T23:23:56.000Z","dependencies_parsed_at":"2025-01-17T00:29:57.146Z","dependency_job_id":null,"html_url":"https://github.com/Rowlkh/Skin-Detection","commit_stats":null,"previous_names":["rowlkh/skin-detection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rowlkh%2FSkin-Detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rowlkh%2FSkin-Detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rowlkh%2FSkin-Detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rowlkh%2FSkin-Detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rowlkh","download_url":"https://codeload.github.com/Rowlkh/Skin-Detection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244036234,"owners_count":20387480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["classification","deep-learning","image-processing","image-segmentation","machine-learning","opencv","python","skin-detection"],"created_at":"2025-01-23T22:21:48.250Z","updated_at":"2026-05-19T17:11:25.349Z","avatar_url":"https://github.com/Rowlkh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Skin Detection using Image Processing and Classification\n\n## Overview\n\nThis project implements a skin detection system using various image processing techniques and machine learning models. It aims to classify image pixels as skin or non-skin, which has numerous applications, including medical diagnosis, augmented reality, and image editing.\n\n## Project Objectives\n\n- Implement a comprehensive pipeline for skin detection.\n- Evaluate the performance of different algorithms in classifying skin areas.\n- Visualize the results of each stage to better understand the image processing workflow.\n\n## Folder Structure\n\nThe project is organized into the following files:\n\n- **image_acquisition.py**: Handles loading and resizing images from specified directories.\n- **preprocessing.py**: Contains functions for image enhancement and restoration.\n- **segmentation.py**: Implements algorithms for segmenting skin areas from images.\n- **ml_models.py**: Includes machine learning models for feature extraction and classification.\n- **main.py**: The main script that runs the entire pipeline and executes all steps.\n\n## Setup and Installation\n\n### Requirements\n\nMake sure you have the following Python libraries installed:\n\n- OpenCV\n- NumPy\n- scikit-learn\n- Matplotlib\n\nYou can install them using `pip`:\n\n```bash\npip install opencv-python numpy scikit-learn matplotlib\n```\n\n### Running the Project\n\nTo run the project, simply execute the `main.py` script:\n\n```bash\npython main.py\n```\n\nThis will load the images, apply preprocessing, perform segmentation, extract features, and then train the machine learning models to classify skin regions.\n\n## Methodology\n\n### Image Acquisition\n\nImages are acquired from two directories: one containing skin images and the other containing non-skin images. The `load_images_from_folder` function is used to load and resize images to 800x600 pixels. The function also ensures that grayscale images are converted to RGB format.\n\n### Preprocessing\n\n- **Gaussian Blur**: Reduces image noise to enhance skin detection accuracy.\n- **Gamma Correction**: Enhances image brightness and contrast for better skin detection.\n\n### Segmentation\n\n- **Color Space Conversion**: Converts the image from BGR to HSV color space, which is more effective for identifying skin tones.\n- **Skin Tone Range**: Defines a range for typical skin tones in HSV values.\n- **Morphological Operations**: Removes noise and fills small holes in the detected skin areas.\n- **Mask Application**: A binary mask is created where skin areas are white, and non-skin areas are black.\n\n### Feature Extraction\n\nFeatures are extracted from the segmented images, including:\n\n- **Color Space Conversion**: Converts images to HSV color space.\n- **Histogram Calculation**: Computes histograms for each HSV channel.\n- **Mean Intensity**: Measures overall brightness.\n- **Canny Edge Detection**: Detects edges in the image.\n\n### Model Training and Evaluation\n\nThe models (Logistic Regression and Random Forest) are trained using extracted features:\n\n- **Data Splitting**: The dataset is split into 70% training and 30% testing.\n- **Model Training**: Both models are trained using the training set.\n- **Model Evaluation**: Performance is assessed using a confusion matrix, ROC curve, and classification report.\n\n### Testing and Results\n\nThe models are evaluated using test images. Each test image undergoes the following steps:\n\n1. **Preprocessing**\n2. **Segmentation**\n3. **Feature Extraction**\n4. **Classification**\n\nThe results of the classification are visualized for both models (Random Forest and Logistic Regression).\n\n## Results\n\n- **Random Forest Classifier**: Shows how well the Random Forest model performed on the test set.\n- **Logistic Regression**: Displays the performance of the Logistic Regression model on the same test set.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frowlkh%2Fskin-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frowlkh%2Fskin-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frowlkh%2Fskin-detection/lists"}