Click here to Skip to main content
15,912,578 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Help decoding a friendly message Pin
BillyTed27-Aug-09 12:23
BillyTed27-Aug-09 12:23 
Questiondata formatting Pin
benjamin yap24-Aug-09 5:39
benjamin yap24-Aug-09 5:39 
AnswerRe: data formatting Pin
N a v a n e e t h24-Aug-09 7:05
N a v a n e e t h24-Aug-09 7:05 
GeneralRe: data formatting Pin
benjamin yap24-Aug-09 16:18
benjamin yap24-Aug-09 16:18 
GeneralRe: data formatting Pin
N a v a n e e t h24-Aug-09 16:47
N a v a n e e t h24-Aug-09 16:47 
GeneralRe: data formatting Pin
benjamin yap24-Aug-09 17:05
benjamin yap24-Aug-09 17:05 
GeneralRe: data formatting Pin
N a v a n e e t h24-Aug-09 17:37
N a v a n e e t h24-Aug-09 17:37 
QuestionImplementing Fax Protocol Pin
ran923-Aug-09 1:33
ran923-Aug-09 1:33 
AnswerRe: Implementing Fax Protocol Pin
Roger Wright24-Aug-09 12:04
professionalRoger Wright24-Aug-09 12:04 
QuestionRe: Implementing Fax Protocol Pin
ran924-Aug-09 23:30
ran924-Aug-09 23:30 
AnswerRe: Implementing Fax Protocol Pin
ran925-Aug-09 6:43
ran925-Aug-09 6:43 
AnswerRe: Implementing Fax Protocol Pin
LezWilliams6-Sep-09 15:56
LezWilliams6-Sep-09 15:56 
QuestionHashtable with two tables (Cuckoo Hashing) Pin
Quake2Player22-Aug-09 16:55
Quake2Player22-Aug-09 16:55 
AnswerRe: Hashtable with two tables (Cuckoo Hashing) Pin
Moreno Airoldi23-Aug-09 1:17
Moreno Airoldi23-Aug-09 1:17 
AnswerRe: Hashtable with two tables (Cuckoo Hashing) Pin
Nagy Vilmos25-Aug-09 5:19
professionalNagy Vilmos25-Aug-09 5:19 
AnswerRe: Hashtable with two tables (Cuckoo Hashing) Pin
supercat927-Aug-09 7:57
supercat927-Aug-09 7:57 
QuestionSpace complexity Pin
kirancgi22-Aug-09 6:45
kirancgi22-Aug-09 6:45 
AnswerRe: Space complexity Pin
kabirbdboy22-Aug-09 20:43
kabirbdboy22-Aug-09 20:43 
QuestionSkin color detection help me Pin
kabirbdboy19-Aug-09 6:56
kabirbdboy19-Aug-09 6:56 
D'Oh! | :doh: hello everybody,i have find a source code of a skin color detection.this program is run well.but i need the explanation of this code.can any body explain this code.i code is given below.....


void Color(IplImage *img);

struct num
{
unsigned char H;
unsigned char S;
unsigned char V;
};


int main( int argc, char** argv )
{
IplImage* pFrame = NULL;
CvCapture* pCapture = NULL;
cvNamedWindow("video",1);
pCapture = cvCaptureFromCAM(-1);
if(pCapture)
{
for(;;)
{
pFrame = cvQueryFrame(pCapture);
Color(pFrame);
// Color_Guass(pFrame);

cvShowImage("video",pFrame);
if(cvWaitKey(10)>=0)
break;
}
cvReleaseCapture(&pCapture);
}
cvDestroyWindow("video");
cvReleaseImage(&pFrame);
return 0;
}


void Color(IplImage *img)
{

int i,j;
IplImage *img_hsv = 0;
img_hsv = cvCreateImage(cvGetSize(img),8,3);
cvCvtColor(img,img_hsv,CV_BGR2HSV);
struct num **bmpdata;
struct num **bmpdata1;
bmpdata = new num*[img->height];
bmpdata1 = new num*[img->height];


//from here i dont understand.please replay me if anybody can understand..........................




for(i=0;i<img->height;i++)
{
bmpdata[i] = new num[img->width];
bmpdata1[i] = new num[img->width];

}

for(i=0;i<img->height;i++)
for(j=0;j<img->width;j++)
{
bmpdata[i][j].H=((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3];
bmpdata[i][j].S=((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3+1] ;
bmpdata[i][j].V=((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3+2];
}
for (i=0;i<img->height;i++)
{
for (j=0;j<img->width;j++)
{
if(bmpdata[i][j].H<=19&&bmpdata[i][j].S>=48)
bmpdata[i][j].H+=0;
else bmpdata[i][j].H=bmpdata[i][j].S=bmpdata[i][j].V=0;
}
}

for (i=1;i<img->height-1;i++)
for (j=1;j<img->width-1;j++)
{
if(bmpdata[i][j].H!=0)
if(bmpdata[i][j-1].H==0||bmpdata[i][j+1].H==0||
bmpdata[i+1][j].H==0||bmpdata[i-1][j].H==0
){
bmpdata1[i][j].H=0;
bmpdata1[i][j].S=0;
bmpdata1[i][j].V=0;
}
else{
bmpdata1[i][j].H+=0;
bmpdata1[i][j].S+=0;
bmpdata1[i][j].V+=0;
}

}


for (i=0;i<img->height;i++)
for (j=0;j<img->width;j++)
{

((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3]=bmpdata[i][j].H;
((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3+1]=bmpdata[i][j].S;
((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3+2]=bmpdata[i][j].V;


}
cvCvtColor(img_hsv,img,CV_HSV2BGR);
cvErode(img,img,NULL,1);
cvDilate(img,img,NULL,1);
}
AnswerRe: Skin color detection help me Pin
Tim Craig19-Aug-09 13:58
Tim Craig19-Aug-09 13:58 
GeneralRe: Skin color detection help me Pin
kabirbdboy19-Aug-09 14:03
kabirbdboy19-Aug-09 14:03 
GeneralRe: Skin color detection help me Pin
Tim Craig19-Aug-09 20:43
Tim Craig19-Aug-09 20:43 
GeneralRe: Skin color detection help me Pin
Tim Craig21-Aug-09 14:28
Tim Craig21-Aug-09 14:28 
GeneralRe: Skin color detection help me Pin
kabirbdboy22-Aug-09 19:34
kabirbdboy22-Aug-09 19:34 
GeneralRe: Skin color detection help me Pin
Tim Craig22-Aug-09 21:27
Tim Craig22-Aug-09 21:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.