Click here to Skip to main content
15,888,733 members
Home / Discussions / Algorithms
   

Algorithms

 
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 
GeneralRe: Skin color detection help me Pin
kabirbdboy23-Aug-09 4:04
kabirbdboy23-Aug-09 4:04 
GeneralRe: Skin color detection help me Pin
Tim Craig23-Aug-09 7:57
Tim Craig23-Aug-09 7:57 
AnswerRe: Skin color detection help me Pin
arunkamaraj20-Jan-10 19:27
arunkamaraj20-Jan-10 19:27 
QuestionMD5CryptoServiceProvider's ComputeHash doesn't match (x86 vs x64)? Pin
francoisdotnet18-Aug-09 6:13
francoisdotnet18-Aug-09 6:13 
GeneralRe: <object>.GetHashCode doesn't match (x86 vs x64)? [modified]</object> Pin
francoisdotnet18-Aug-09 21:22
francoisdotnet18-Aug-09 21:22 
GeneralRe: .GetHashCode doesn't match (x86 vs x64)? Pin
supercat919-Aug-09 6:44
supercat919-Aug-09 6:44 
GeneralRe: .GetHashCode doesn't match (x86 vs x64)? Pin
francoisdotnet19-Aug-09 10:46
francoisdotnet19-Aug-09 10:46 
GeneralRe: .GetHashCode doesn't match (x86 vs x64)? Pin
supercat919-Aug-09 14:34
supercat919-Aug-09 14:34 
GeneralRe: .GetHashCode doesn't match (x86 vs x64)? Pin
francoisdotnet19-Aug-09 20:43
francoisdotnet19-Aug-09 20:43 
AnswerRe: MD5CryptoServiceProvider's ComputeHash doesn't match (x86 vs x64)? Pin
Luc Pattyn20-Aug-09 0:49
sitebuilderLuc Pattyn20-Aug-09 0:49 
QuestionVariable Depth For Loop to create a number sequence... Pin
Aaron @ Think Software17-Aug-09 14:46
professionalAaron @ Think Software17-Aug-09 14:46 

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.