Info

This question is closed. Reopen it to edit or answer.

program for calculating skin probability not working. please help.

3 views (last 30 days)
I was making a program using gmdistribution. But, it is giving error at the gmdistribution command. I saw the algo of this on internet itself and tried it.
The program is :
frame20 = double(imread('image6.jpg'));
[rows,cols,bands] = size(frame20);
skin_detection = zeros(rows, cols);
for row = 1:rows
for col = 1:cols
red = frame20(row, col, 1);
green = frame20(row, col, 2);
blue = frame20(row, col, 3);
r = gmdistribution(red_mean, red_std, red); red_pr=pdf(r,red);
g = gmdistribution(green_mean, green_std, green) green_pr=pdf(g,green);
b = gmdistribution(blue_mean, blue_std, blue); blue_pr=pdf(b,blue);
prob = red_pr .* green_pr .* blue_pr; skin_detection(row, col)= prob;
end
end
This is giving error:
??? Error using ==> gmdistribution.gmdistribution>gmdistribution.gmdistribution at 158 The mixing proportions must be positive.
Error in ==> trial_gauss_fullimage at 51 g = gmdistribution(green_mean, green_std, green); Error in ==> trial_gauss_fullimage at 52 green_pr=pdf(g,green);
The name of my file is trial_gauss_fullimage.
In this the mean and std values of red, green and blue it calculated and these are 1*1 matrix i.e. constant one value eg. red_mean is 237.2865 and red_std is 13.8627. Same holds for red also.
I hope I have been able to explain my problem. If you can help me out it would be great.
Thanks,
Nidhi

Answers (1)

Tom Lane
Tom Lane on 26 Jun 2012
Best to keep the discussion in a single thread here.

This question is closed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!