Here fram1 and fram2 are extracted framse from cam
frameA = cvCloneImage( fram1 );//clone of orignal frame 1
frameB = cvCloneImage( fram2 );//clone of originak frame2
//Set the HSV skin color threhshold values.\n”);
//Only for hand skin values
double h1 =0, s1 = 30, v1 = 80;
double h2 =20, s2 = 150, v2 = 255;
// set the min and max value..\n”);
CvScalar const minVal = cvScalar( h1,s1,v1 );
CvScalar const maxVal = cvScalar( h2,s2,v2 );
/*==========>> Background removing in hsv Space & MEdian Smooth < Background removing in hsv Space & MEdian Smooth================*/
/*==========Start::==Hand Segmentation and noise removing===========*/
//apply the thresold on copy of hsvImgSub..\n”);
cvInRangeS( cpyHSVDiff , minVal , maxVal , hsvThreshy );
///Smooth the hsvSubThreshold image…\n”);
//erode or dilate( element that determines the shape of a pixel neighborhood over which the maximum is taken: )
//……..with 3 x 3 structuring element
cvDilate( hsvThreshy , cpyThreshy , 0 , 2 );
cpyThreshy = cvCloneImage( hsvThreshy );
// find the contour of moving images in the frame..\n”);
CvMemStorage* g_storage = cvCreateMemStorage(0);
CvSeq* contours = 0;
g::nFrmNum++;
// find the number of contours..\n”);
int nc = cvFindContours(cpyThreshy,g_storage,&contours,sizeof(CvContour), CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE, cvPoint(0,0));
CvSeq* contours2 = NULL;
double result = 0, result2 = 0;
//Area calculated from contours
while(contours)
{
result = fabs( cvContourArea( contours, CV_WHOLE_SEQ ) );
if ( result > result2)
{
result2 = result; contours2 = contours;
};
contours = contours->h_next;
};
if(contours2)
{
CvRect rect = cvBoundingRect( contours2 , 0 );
int x = rect.x;
int y = rect.y;
Since due to frame difference, only edges are detected .
but broken so, rectangle set where edges appeared .
I used frame difference just for removing background,.
I need hand ,.not edges .
I want to set rectangle on this threshold image and then check the threshold image data with original image . if matched then hand extracted .
How can i set the rectangle on my hand in thresholded image.
While my edges are broken.
I have compiled the source code,but it requires a file named VideoInput.h
I don’t have it..could you please tell me where to find it?
Thanks for your hard work
i think you should check your visual studio configuration and project property first. because ‘unresolved external symbol’ comes from header file missing.
@Daniel please check your installation & included file s are all rightly set. Or search the error code in Google, there are plenty of solutions according to errors.
I have manage to compile it. Basically must be set the environment for project. I’m using VC++ 6. Page below it’s about VS 2003-2005 but directions for project settings are very usefull. I have followed the linker section too (fast reading/jumping leads to bad results), it complied and it’s running.
I think the program lacks of head files ,you can add these files , following like this project–>settings–>Link–>Object/Library modules (cv.lib cvaux.lib cxcore.lib highgui.lib )
helloow..nice program but i cannot download the source code..:(“Oops, something you are looking for isn’t here.
Go back to Andol.info”
please if you can ..send to my email..Thanks
The code can run but needs to add all the OpenCV libraries as a Win32 app in Visual C++ 2008 Express Ed. But the code only does color abstraction and does not actually show the location of the hand. What happened?
That is a part of hand recognition which abstract the hand contours from background image. About the location of the hand, once the contour can be detected then, by using ‘cvFindContours‘ & ‘cvApproxPoly‘ the location would be available there.
hello sir,
while running videos from opencv program some .avi videos run successfully but some .avi vedio does not.
Is there something like placing dll files there or something else plz help me sir.
Hi!! Andol. Please help me. I compiled source code, but can not find “VideoInput.h” this file. You say “delete videoinput.h”, and the use of other programs. I ask what program you use . Can you send me all of project? I am a beginner, do not use opencv. sincerely you please help
@Sam This is the full project with only one .cpp file, videoinput.h comes from another video analysis library and it is left in this project with no use. So the solution to ‘can not find videoinput.h’ is to delete the line of ‘#include ‘, then it works as long as your openCV has been configured properly.
Sir, I am a Ph.D. student of Dhaka University of Bangladesh. My research Topic is “Bangali Sign Language recognition”. So Please help me. I compiled your source code, but can not find “VideoInput.h” this file as following error:
Error 1 fatal error C1083: Cannot open include file: ‘VideoInput.h’: No such file or directory
Hi Aminur, just ignore the line of ‘videoinput.h’, that was a library in my computer for video analysis, not for this project. So you can comment this line, and the code will go.
This was caused by a incorrect use of function which released the memory already but after that a function unknowingly tried to read this memory address again, which caused the memory reading violation.
Hi Koos, the xml file can be made if the sample images are provided, since these samples of both negative and positive are key to cascade training and generating the xml file.
fgsdgdsf
thank you for your writting about hand gesture recognition with openCV.
This is exactly what i’m finding.
I hope you can present some more code on this
Sure i will.
Hi Andol,
I am new in OpenCV .
I need to detect my hand using Frame difference Method .
Since Frame difference remove background and give edges in form of shadow as result .
Result: http://imm.io/8cM8
http://imm.io/8cMa
Code:
Here fram1 and fram2 are extracted framse from cam
frameA = cvCloneImage( fram1 );//clone of orignal frame 1
frameB = cvCloneImage( fram2 );//clone of originak frame2
//Set the HSV skin color threhshold values.\n”);
//Only for hand skin values
double h1 =0, s1 = 30, v1 = 80;
double h2 =20, s2 = 150, v2 = 255;
// set the min and max value..\n”);
CvScalar const minVal = cvScalar( h1,s1,v1 );
CvScalar const maxVal = cvScalar( h2,s2,v2 );
/*==========>> Background removing in hsv Space & MEdian Smooth < Background removing in hsv Space & MEdian Smooth================*/
/*==========Start::==Hand Segmentation and noise removing===========*/
//apply the thresold on copy of hsvImgSub..\n”);
cvInRangeS( cpyHSVDiff , minVal , maxVal , hsvThreshy );
///Smooth the hsvSubThreshold image…\n”);
//erode or dilate( element that determines the shape of a pixel neighborhood over which the maximum is taken: )
//……..with 3 x 3 structuring element
cvDilate( hsvThreshy , cpyThreshy , 0 , 2 );
cpyThreshy = cvCloneImage( hsvThreshy );
// find the contour of moving images in the frame..\n”);
CvMemStorage* g_storage = cvCreateMemStorage(0);
CvSeq* contours = 0;
g::nFrmNum++;
// find the number of contours..\n”);
int nc = cvFindContours(cpyThreshy,g_storage,&contours,sizeof(CvContour), CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE, cvPoint(0,0));
CvSeq* contours2 = NULL;
double result = 0, result2 = 0;
//Area calculated from contours
while(contours)
{
result = fabs( cvContourArea( contours, CV_WHOLE_SEQ ) );
if ( result > result2)
{
result2 = result; contours2 = contours;
};
contours = contours->h_next;
};
if(contours2)
{
CvRect rect = cvBoundingRect( contours2 , 0 );
int x = rect.x;
int y = rect.y;
cvRectangle( frameA, cvPoint(rect.x, rect.y + rect.height), cvPoint(rect.x + rect.width, rect.y), CV_RGB(255, 0, 0), 5, 8, 0 );
}
Note:
Since due to frame difference, only edges are detected .
but broken so, rectangle set where edges appeared .
I used frame difference just for removing background,.
I need hand ,.not edges .
I want to set rectangle on this threshold image and then check the threshold image data with original image . if matched then hand extracted .
How can i set the rectangle on my hand in thresholded image.
While my edges are broken.
Please guide me ;
Thanks
Actually, i am preparing for some precise hand gestures detection & recognitions, it will come up soon.
thanks
I have compiled the source code,but it requires a file named VideoInput.h
I don’t have it..could you please tell me where to find it?
Thanks for your hard work
you can just delete videoinput.h. i used that file to debugg another application in my computer.
it also gives me some errors :
Linking…
1.obj : error LNK2001: unresolved external symbol _cvDestroyAllWindows
1.obj : error LNK2001: unresolved external symbol _cvReleaseCapture
1.obj : error LNK2001: unresolved external symbol _cvWaitKey
1.obj : error LNK2001: unresolved external symbol _cvInRangeS
1.obj : error LNK2001: unresolved external symbol _cvCvtColor
1.obj : error LNK2001: unresolved external symbol _cvShowImage
1.obj : error LNK2001: unresolved external symbol _cvNamedWindow
1.obj : error LNK2001: unresolved external symbol _cvCreateImage
1.obj : error LNK2001: unresolved external symbol _cvGetSize
1.obj : error LNK2001: unresolved external symbol _cvQueryFrame
1.obj : error LNK2001: unresolved external symbol _cvCreateCameraCapture
Debug/a.exe : fatal error LNK1120: 11 unresolved externals
Error executing link.exe.
Could you tell me what cause that errors?
Thank You!
i think you should check your visual studio configuration and project property first. because ‘unresolved external symbol’ comes from header file missing.
I face the same error . could you please tell me how did you fixed it ?
Regards,
DAniel
@Daniel please check your installation & included file s are all rightly set. Or search the error code in Google, there are plenty of solutions according to errors.
I have manage to compile it. Basically must be set the environment for project. I’m using VC++ 6. Page below it’s about VS 2003-2005 but directions for project settings are very usefull. I have followed the linker section too (fast reading/jumping leads to bad results), it complied and it’s running.
http://opencv.willowgarage.com/wiki/VisualC%2B%2B
I think the program lacks of head files ,you can add these files , following like this project–>settings–>Link–>Object/Library modules (cv.lib cvaux.lib cxcore.lib highgui.lib )
cheers Linxiflying
great job!
thank alot!
you welcome.
helloow..nice program but i cannot download the source code..:(“Oops, something you are looking for isn’t here.
Go back to Andol.info”
please if you can ..send to my email..Thanks
Much thanks for your program.
Dear Andol , I can’t download the source code .
please if you cam sent to my email , thanks very much.
Please try to refer to here below:
http://www.andol.info/download/hsv.cpp
http://www.andol.info/download/HoughCircle.cpp
http://www.andol.info/download/haarFaceDetect.cpp
The code can run but needs to add all the OpenCV libraries as a Win32 app in Visual C++ 2008 Express Ed. But the code only does color abstraction and does not actually show the location of the hand. What happened?
That is a part of hand recognition which abstract the hand contours from background image. About the location of the hand, once the contour can be detected then, by using ‘
cvFindContours‘ & ‘cvApproxPoly‘ the location would be available there.thank you for your good job.
Sir, this code works for a live webcam feed, how do you make it work for an input of still image and .avi video files only?
have a look at this http://www.andol.info/hci/830.htm#comment-1072
hello sir,
while running videos from opencv program some .avi videos run successfully but some .avi vedio does not.
Is there something like placing dll files there or something else plz help me sir.
would you check is there any difference between these two types of .avi videos?
hi Andol,
iam a student doing project in hand gesture recognition.I want to separate hand region from background in online video.please help me.
@Kutu some examples of detecting and extracting hand shapes are recommended to have a look, firstly
working great!
Thank you!
Hi!! Andol. Please help me. I compiled source code, but can not find “VideoInput.h” this file. You say “delete videoinput.h”, and the use of other programs. I ask what program you use . Can you send me all of project? I am a beginner, do not use opencv. sincerely you please help
@Sam This is the full project with only one .cpp file, videoinput.h comes from another video analysis library and it is left in this project with no use. So the solution to ‘can not find videoinput.h’ is to delete the line of ‘#include ‘, then it works as long as your openCV has been configured properly.
Sir, I am a Ph.D. student of Dhaka University of Bangladesh. My research Topic is “Bangali Sign Language recognition”. So Please help me. I compiled your source code, but can not find “VideoInput.h” this file as following error:
Error 1 fatal error C1083: Cannot open include file: ‘VideoInput.h’: No such file or directory
Hi Aminur, just ignore the line of ‘videoinput.h’, that was a library in my computer for video analysis, not for this project. So you can comment this line, and the code will go.
Hi, Another problem is raised when run the “handDetection source file .CPP” as follows. What can i do? Please help me.
Unhandled exception at 0x10111fd1 (cv200.dll) in Andol hand detect.exe: 0xC0000005: Access violation reading location 0xffffffff.
This was caused by a incorrect use of function which released the memory already but after that a function unknowingly tried to read this memory address again, which caused the memory reading violation.
Hello,
Interesting stuff here! I am wondering do you have or can you (easy) generate a xml file for “haar-cascade-detection” of hands?
Hope I am making sense (yep, new to this).
Have a good day.
Hi Koos, the xml file can be made if the sample images are provided, since these samples of both negative and positive are key to cascade training and generating the xml file.
I’d like it.