Friday, March 27th, 2009, 1519 days ago

handDetection source file .CPP

handDetection source file .CPP


QR code for this post, SCAN ME
QR:  handDetection source file .CPP

POSTS MAY BE OF INTEREST


81 Responses to “handDetection source file .CPP”

  1. Nguyen says:

    thank you for your writting about hand gesture recognition with openCV.
    This is exactly what i’m finding.

  2. Nguyen says:

    I hope you can present some more code on this

      • tina says:

        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

    • andol says:

      Actually, i am preparing for some precise hand gestures detection & recognitions, it will come up soon.

  3. hack says:

    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

  4. hack says:

    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!

  5. ninhnv says:

    thank alot!

  6. jason says:

    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

  7. Bias says:

    Much thanks for your program.

  8. Bias says:

    Dear Andol , I can’t download the source code .
    please if you cam sent to my email , thanks very much.

  9. Pan says:

    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?

    • Andol says:

      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.

  10. kabir hossain says:

    thank you for your good job.

  11. JP Talusan says:

    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?

  12. priyanka says:

    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.

  13. kutu says:

    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.

  14. eran says:

    working great!

    Thank you!

  15. sam says:

    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

    • Andol says:

      @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.

  16. Aminur says:

    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

    • Andol says:

      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.

  17. Aminur says:

    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.

    • Andol says:

      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.

  18. Koos says:

    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.

Leave a Reply

You can use these XHTML tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>