Ask Your Question

panan160's profile - activity

2014-10-13 02:43:52 -0600 answered a question Convert Bitmap to Mat for JNI interface

you can try this :http://blog.csdn.net/panan160/article/details/23828591 just read onClick() and Java_com_pan_test_ImageProc_grayProc() method

2014-10-09 02:53:25 -0600 commented answer Use hog.detectMultiScale in multiple threads?

thanks~the problem is reslove

2014-10-09 02:52:21 -0600 commented question Use hog.detectMultiScale in multiple threads?

thanks,i made a mistake

2014-10-09 02:51:40 -0600 received badge  Supporter (source)
2014-09-26 21:46:04 -0600 asked a question Use hog.detectMultiScale in multiple threads?

When I do pedestrian detection width Hog + SVM in OpenCV ,I try to using it in two thread to improve the detect speed.But I got OpenCV error: Assertion failed<s >=0> in unknown function,file ..\..\..\opencv\modules\core\src\matrix.cpp,line 116

My code:

DWORD WINAPI DetectFrame1(LPVOID lpPrarmeter){
    HOGDescriptor hog1;
    hog1.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());

    while(true){
        WaitForSingleObject(g_hEvent1,INFINITE);        

        int temp;
        hog1.detectMultiScale(detImg1, found1, 0, cv::Size(8,8), cv::Size(0,0), 1.08, 2);  
        //cout<<"得到一帧near :"<<frame<<endl;
        //temp=frame;       // 标志当前处理帧 [9/26/2014 pan]

        if(!detImg1.empty()){
            imshow("det1",detImg1);
        }
        waitKey(10);
        cout<<"1——检测到行人:"<<found1.size()<<endl;
        SetEvent(g_hEvent1);
    }
    return 0;
}
DWORD WINAPI DetectFrame2(LPVOID lpPrarmeter){
    HOGDescriptor hog2;
    hog2.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());         // 该函数不能并发 [9/26/2014 pan]
    while(true){    
        WaitForSingleObject(g_hEvent2,INFINITE);    
        int temp;
        //cout<<"得到一帧far :"<<frame<<endl;
        //temp=frame;           // 标志当前处理帧 [9/26/2014 pan]
        hog2.detectMultiScale(detImg2, found2, 0, cv::Size(8,8), cv::Size(0,0), 1.08, 2);  

        if(!detImg2.empty()){
            imshow("det2",detImg2);
        }
        waitKey(10);
        cout<<"2——检测到行人:"<<found2.size()<<endl;
        SetEvent(g_hEvent2);        // 变为有信号状态 [9/26/2014 pan]
    }
    return 0;
}

Can anyone help me ,thanks.