Detecting skin in colour images, Computer Graphics

Assignment Help:

In this lab you will learn how to use chrominance1 to segment coloured images. Here you be detecting skin, however, you could use this method to detect other coloured regions in images.

Firstly you will build a model describing the likelihood that any pair of chrominance values belongs to a piece of skin. Secondly you will test images and identify likely skin regions.

Getting Started

1. Download the following files from the course web site

  • the image 'face.jpg'.
  • the incomplete file 'Lab2.m', and
  • the file 'RGB2Lab.m'

Save these in the directory you are using for this lab.

Deliverable:

To gain the marks for this lab you will need to show me your completed Lab2 function running during the lab. Complete the function Lab2 by writing the two sub-functions

make_chroma_model, and

find_chroma

The specifications of these functions can be found in the downloadable file Lab2.m

What to do

Firstly have a look at the Lab3 file. Run it and see what it does. First it defines some constants num_bins and gsize. Then it loads an image and converts it to double in the range [0,1], but leaves it in RGB format. It then crops a region defined by the user.

While you write and debugging this program it is convenient not to have to select a region each time you run the program. Comment out the lines that display the prompt to the user and interactively crop the image, we'll enable them again later once the code's working. For the meantime crop the image automatically like this:

sample_colour = im_RGB(130:150,90:138,:);

This takes rows 130 to 150, columns 90 to 138, and all 3 colour channels. Notice that the

':' is used to mean 'everything inbetween' when it's between two indexes, or 'everything' when it's on it's own.

1 Colour has 3 channels, eg RGB, HSV. Chrominance is a two channel derivative of a colour that is independent of intensity. See lecture on Colour theory.

2 Now let's start on the function make_chroma_model. Firstly we need to convert from RGB colour space to CIE Lab colour space using RGB2Lab.m,

[L,a_chroma,b_chroma] = RGB2Lab(sample_colour);

RGB2Lab returns real a,b chrominance values in the range [-120,120] . We want to use these as indexes to an accumulator array, so we need to convert them to integers in the range [0, num_bins], where num_bins is a constant defining the size of each dimension of our accumulator array. To do this we will write a very short sub-function.

Write a sub-function ab2ind that is passed 2 parameters ab_chroma and num_bins and returns an index ind. This will only take two lines. Firstly convert ab_chroma from the range [-120,120] to [0,1].

ab_01 = ((ab_chroma)+120)/240;

Secondly discretise this into an integer index ind in the range [1,num_bins].

ind = round(ab_01*(num_bins-1)) + 1;

round rounds to the nearest integer. Note the minus 1 and plus 1 that are necessary to firstly scale to the range [0, num_bins-1] then increase this to [1, num_bins].

Getting back to make_chroma_model, we can now call our new sub-function to convert our a,b chrominance values to indexes for the accumulator array, e.g. for

a_chroma

a_ind = ab2ind(a_chroma, num_bins);

Now we are ready to start building the skin chrominance model. Create an accumulator array, this will be a num_bins × num_bins matrix of zeroes, use the zeros function to do this, call this matrix accum_array. We will use this for counting the occurrences of different chroma pairs and it will form the basis of our skin chrominance model.

Now we need to count the number of occurrences of each chroma pair. To do this you will need to use for loops to consider every pixel in the image. Look at the a find and b find values of each pixel and increment the appropriate cell in the accumulator array.

Done that? Have a look at your result using imagesc as follows, figure;

imagesc(accum_array); axis image;

xlabel('a'); ylabel('b'); title('Points in ab space');

 


Related Discussions:- Detecting skin in colour images

Mapping of a fraction -windowing transformations, Mapping of a Fraction -Wi...

Mapping of a Fraction -Windowing Transformations The mapping of a fraction of a world coordinate scene to device coordinates is considered to as Viewing Transformation. In com

Basic graphics and mouse events, For this assignment, you will program a ga...

For this assignment, you will program a game called Pig. Pig is a two-player game where players compete to be the first to reach (or surpass) 100 points. Pig usually involves playe

Linear filtering concept -horizontal & vertical sobel filter, This question...

This question is about linear filtering concepts using the built in filtering functions (it is not about edge detection methods). Load an MRI image and perform the following: i.

Input and hardcopy devices - 2d shape primitives, Input and Hardcopy Device...

Input and Hardcopy Devices  This section gives a brief introduction to the functioning of some well known input and hardcopy devices. Input devices include keyboard, mouse, sca

Parallel projection - viewing transformation, Parallel Projection - viewing...

Parallel Projection - viewing transformation Parallel projection methods are utilized by engineers to make working drawings of an object that preserves its true shape. In t

Is cad only helpful for design drawings, Question: Is CAD only helpful for ...

Question: Is CAD only helpful for design drawings? No. When true-scale, structurally valid drawings are the purpose for CAD's existence; it utilizes is as diverse as imagination

Classic applications of digital video, The table as given below demonstrate...

The table as given below demonstrates possible values of such parameters for classic applications of digital video. Application                  Frame rate                  Dime

What is an axonometric orthographic projection, What is an axonometric orth...

What is an axonometric orthographic projection and cabinet projection? The orthographic projection can show more than one face of an object.  Such an orthographic projection i

Authoring tools in multimedia, Authoring Tools Authoring tools genera...

Authoring Tools Authoring tools generally refers to computer software that assists multimedia developers produce products. Authoring tools are various from computer programmi

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd