johnwilson92 asked . 2020-04-22

How to detect skin region in YCbCr color space?

I want to detect skin region in images which contain hand, foot or mouth and remove the background. The YCbCr color space is used in my work. I can convert the image into YCbCr color space and split each color channel in this color space but could go further. I have attached an image shows the original image and the detected skin region which I want (It was performed in a paper).
Any help would be deeply appriciated.
Here is some of my code:
% Read image
imgRGB = imread('ColorSpace\hand_foot12.jpg');

% Convert to YCbCr
YCbCr = rgb2ycbcr(imgRGB);

% Split each channel
Y=YCbCr( :,:,1);
Cb=YCbCr( :,:,2);
Cr=YCbCr( :,:,3);

skin region

skin region, image processing,matlab

Expert Answer

Prashant Kumar answered . 2024-12-21 17:06:09

You can use ‘Color Thresholder’ app provided in the Image Acquisition Toolbox.
  1. After loading the image from a file/workspace, you can choose a color space for the image. Since you want to extract purple and yellow colours, I would recommend you to use YCbCr for purple colour and RGB space for the yellow colour.
  2. You would then see the image along with a set of controls for each colour component, depending on the colour space chosen. Adjust these controls to get the colour you want. And ‘Export Function’ for the resultant image.
  3. By exporting to function, you get Min and Max values for each channel for both the colours (yellow and Purple). You would also get a sliderBW matrix in each function. Use logical operator || to include both the matrices in your workspace and then set these pixels to white colour.

Below is the code for an image file named ‘peppers.png’ and may need to be changed in some cases -

 

% Load your image in RGB variable 
% Convert RGB image to chosen color space 
I = RGB; 
  
% Define thresholds for channel 1 based on histogram settings 
channel1Min = 53.000; 
channel1Max = 178.000; 
  
% Define thresholds for channel 2 based on histogram settings 
channel2Min = 55.000; 
channel2Max = 153.000; 
  
% Define thresholds for channel 3 based on histogram settings 
channel3Min = 37.000; 
channel3Max = 142.000; 
  
% Create mask based on chosen histogram thresholds 
sliderBW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & ... 
    (I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ... 
    (I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max); 
BW = sliderBW; 
  
% Initialize output masked image based on input image. 
maskedRGBImage = RGB; 
  
% Set background pixels where BW is false to zero. 
maskedRGBImage(repmat(~BW,[1 1 3])) = 0; 
 


Not satisfied with the answer ?? ASK NOW

Frequently Asked Questions

MATLAB offers tools for real-time AI applications, including Simulink for modeling and simulation. It can be used for developing algorithms and control systems for autonomous vehicles, robots, and other real-time AI systems.

MATLAB Online™ provides access to MATLAB® from your web browser. With MATLAB Online, your files are stored on MATLAB Drive™ and are available wherever you go. MATLAB Drive Connector synchronizes your files between your computers and MATLAB Online, providing offline access and eliminating the need to manually upload or download files. You can also run your files from the convenience of your smartphone or tablet by connecting to MathWorks® Cloud through the MATLAB Mobile™ app.

Yes, MATLAB provides tools and frameworks for deep learning, including the Deep Learning Toolbox. You can use MATLAB for tasks like building and training neural networks, image classification, and natural language processing.

MATLAB and Python are both popular choices for AI development. MATLAB is known for its ease of use in mathematical computations and its extensive toolbox for AI and machine learning. Python, on the other hand, has a vast ecosystem of libraries like TensorFlow and PyTorch. The choice depends on your preferences and project requirements.

You can find support, discussion forums, and a community of MATLAB users on the MATLAB website, Matlansolutions forums, and other AI-related online communities. Remember that MATLAB's capabilities in AI and machine learning continue to evolve, so staying updated with the latest features and resources is essential for effective AI development using MATLAB.

Without any hesitation the answer to this question is NO. The service we offer is 100% legal, legitimate and won't make you a cheater. Read and discover exactly what an essay writing service is and how when used correctly, is a valuable teaching aid and no more akin to cheating than a tutor's 'model essay' or the many published essay guides available from your local book shop. You should use the work as a reference and should not hand over the exact copy of it.

Matlabsolutions.com provides guaranteed satisfaction with a commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been empanelled after extensive research and quality check.

Matlabsolutions.com provides undivided attention to each Matlab assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work done at the best price in industry.