Basler Pylône 4 SDK et OPENCV 2.4.8, Linux simple spectateur

Je suis l'élaboration d'une simple camera viewer pour tester la caméra Basler acA1300-30gc. Je travaille sous Ubuntu 14.04 avec Basler Pylône 4 et OPENCV version 2.4.8 parce que je vais développer une application de vision industrielle et j'ai besoin d'analyser les images à la volée.

Basé sur OpenCV Image De L'Écran De Tutoriel, des exemples de Code dans le Pylône de la Documentation et cette question similaire j'écris le code suivant.

Code:

int main(int argc, char* argv[]) {

    Pylon::PylonAutoInitTerm autoInitTerm;
    Mat image(IM_HEIGHT, IM_WIDTH, CV_8UC3);
    CGrabResultPtr ptrGrabResult;

    //namedWindow(WIN_NAME,CV_WINDOW_AUTOSIZE);
    try {
        CInstantCamera camera( CTlFactory::GetInstance().CreateFirstDevice());
        cout << "Using device " << camera.GetDeviceInfo().GetModelName() << endl;
        camera.StartGrabbing();

        while(camera.IsGrabbing()){
            camera.RetrieveResult( 5000, ptrGrabResult, TimeoutHandling_ThrowException);
            if (ptrGrabResult->GrabSucceeded()){
                    memcpy(image.ptr(),ptrGrabResult->GetBuffer(),ptrGrabResult->GetWidth()*ptrGrabResult->GetHeight());
                    //if(!image.empty())
                    //imshow(WIN_NAME,image);
                    //if(waitKey(30)==27){
                    //     camera.StopGrabbing();
                    //}
            }
        }
    } catch (GenICam::GenericException &e) {
        cerr << "An exception occurred." << endl  << e.GetDescription() << endl;
    }

    //destroyWindow(WIN_NAME);
    return 0;

}

Je ne sais pas pourquoi décommentant namedWindow(WIN_NAME,CV_WINDOW_AUTOSIZE); la caméra ne prend pas en attraper plus.

Je vous serais très reconnaissant si quelqu'un pourrait m'aider s'il vous plaît.

InformationsquelleAutor smesh | 2014-08-07