Skip to content

Simple MATLAB app to Extract Skintone of the human subject from the given images ( Without using ML )

License

Notifications You must be signed in to change notification settings

PN-Projects/Skintone_detection_using_MATLAB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Skintone Detection Using HSV & YCbCr mask in MATLAB

Introduction

This project presents an innovative MATLAB-based system for detecting skin tone and extracting its representative color in the form of a hex code. The system leverages multi-dimensional color spaces (YCbCr and HSV) combined with k-means clustering for accurate skin tone identification. Designed to be user-friendly yet robust, the extracted hex code enables practical applications such as personalized clothing color recommendations and digital styling.

The methodology integrates manual region selection with algorithmic processes, providing precise results while minimizing errors caused by lighting or background variations. This project is an accessible tool for use in digital fashion, cosmetics, and academic research.

Flow chart

Untitled-diagram-2025-01-11-104316

  • Caution, copying it without permission may lead to legal consequences, kindly go through this

Steps to Set Up and Run

System Requirements

  • MATLAB version: R2023a or later (recommended for optimal compatibility).
  • Operating System:
  • Minimum: Windows 10 64-bit or macOS Catalina.
  • Recommended: Windows 11 64-bit or macOS Ventura.
  • Processor: Dual-core 2.0 GHz or higher.
  • RAM: Minimum 4 GB; Recommended 8 GB or more.

Dependencies

Before running the project, ensure the following MATLAB toolboxes are installed:

Running the Application

Setting Up Environment

Deal with this step by yourself clone the contents of this repo as per your convenience and deal with setting up path etc...

Launch MATLAB

Open MATLAB and navigate to the folder containing the application files.

Run the Application

Execute the main file (ipprojekt_exported.mlapp) by typing the following command in MATLAB’s Command Window:


ipprojekt_exported

Upload an Image

  • Click the "Upload" button and select an image (supported formats: JPG, PNG, BMP).
  • The selected image will be displayed for reference.

Select Skin Region

  • A manual selection tool will appear. Use it to draw a rectangle around the skin region of the image.
  • Ensure the selected area contains only skin for accurate detection.

Process the Image

  • Click the "Process" button to start the analysis.
  • The system will:
    • Generate a skin mask.
    • Extract skin pixels.
    • Perform k-means clustering to identify the dominant tone.
    • Display the hex code and dominant skin tone.

Features

  • Dual-Color Space Segmentation:

    Uses YCbCr and HSV color spaces to ensure reliable skin tone detection under diverse lighting conditions.

  • Manual Skin Region Selection:

    Provides flexibility for precise region identification.

  • Clustering for Dominance:

    k-means clustering isolates the dominant skin tone, reducing noise and errors.

  • Hex Code Representation:

    Converts RGB values of the dominant tone into a hex code, offering a standardized reference.

Additional Notes

  • Ensure high-quality images are used for better results. Poor lighting or low resolution may affect accuracy.
  • If encountering any issues, verify that all toolboxes are installed and the MATLAB version meets the system requirements.

Future Improvements

  • Automating skin region detection using deep learning techniques.
  • Supporting additional color spaces (e.g., Lab, Luv) for higher precision.
  • Expanding recommendations with a machine learning-based algorithm.

LICENSE

Skintone Detection using HSV & YCbCr mask by Parthiv Katapara is licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International