c++opencvubuntucameraximea

xiAPI: Failed to change thread scheduler, check user limit for realtime priority


Trying to operate the Ximea MQ013CG-ON USB 3.0 type camera, using Nvidia Jetson TK1 (# R21 (release), REVISION: 3.0).

When I try run the example opencv_test.cpp code in OpenCV installation information:

#include "cv.h" 
#include "highgui.h" 
#include <stdio.h>  
// A Simple Camera Capture Framework 
int main() 
{
   CvCapture* capture = cvCaptureFromCAM( CV_CAP_XIAPI );
   if ( !capture ) {
     fprintf( stderr, "ERROR: capture is NULL \n" );
     getchar();
     return -1;
   }
   // Create a window in which the captured images will be presented
   cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );
   // Show the image captured from the camera in the window and repeat
   while ( 1 ) {
     // Get one frame
     IplImage* frame = cvQueryFrame( capture );
     if ( !frame ) {
       fprintf( stderr, "ERROR: frame is null...\n" );
       getchar();
       break;
     }
     cvShowImage( "mywindow", frame );
     // Do not release the frame!
     //If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
     //remove higher bits using AND operator
     if ( (cvWaitKey(10) & 255) == 27 ) break;
   }
   // Release the capture device housekeeping
   cvReleaseCapture( &capture );
   cvDestroyWindow( "mywindow" );
   return 0;
}

(Running via):

g++ -I/usr/local/include/opencv opencv_test.cpp -lopencv_highgui
LD_LIBRARY_PATH=/usr/local/lib ./a.out

I get the error messages below:

xiAPI: XIMEA Camera API V4.05.65
xiAPI: Adding camera context: dwID=14510651  ptr=B2AE4000 processID=00005A09
xiAPI: Create handles 1 Process 00005A09
xiAPI: Enable sensor
xiAPI: ENABLE SENSOR
xiAPI: SetDataRate bandwidth 3180; real band 3180; Freq 62; XSM 0
xiAPI: Time needed to read BPL:83ms
xiAPI: ERROR: pixel -7x323 has no correction pixel!
xiAPI: ERROR: pixel -7x1018 has no correction pixel!
xiAPI: ERROR: 2 pixels in list without any correction!
xiAPI: Successfully parsed BPL file, 447 total corrected pixels
xiAPI: SetGPIO 1 set to 8
xiAPI: SetDataRate bandwidth 3180; real band 3180; Freq 62; XSM 0
xiAPI: ERROR: pixel -7x323 has no correction pixel!
xiAPI: ERROR: pixel -7x1018 has no correction pixel!
xiAPI: ERROR: 2 pixels in list without any correction!
xiAPI: SetGPIO 1 set to 0
xiAPI: AutoSetBandwidth measurement
xiAPI: CalculateResources : Context B2AE4000 ID 14510651 m_maxBytes=1024 m_maxBufferSize=1048576
xiAPI: Failed to change thread scheduler, check user limit for realtime priority.
xiAPI: AutoSetBandwidth measured 3083Mbps. Safe margin 10% will be used.
xiAPI: Current bandwidth limit auto-set to 2774 Mbps (min:408Mbps,max:3083Mbps)
xiAPI: SetDataRate bandwidth 2774; real band 2774; Freq 62; XSM 0
xiAPI: ERROR: pixel -7x323 has no correction pixel!
xiAPI: ERROR: pixel -7x1018 has no correction pixel!
xiAPI: ERROR: 2 pixels in list without any correction!
xiAPI: SetDataRate bandwidth 2774; real band 2774; Freq 62; XSM 0
xiAPI: ERROR: pixel -7x323 has no correction pixel!
xiAPI: ERROR: pixel -7x1018 has no correction pixel!
xiAPI: ERROR: 2 pixels in list without any correction!
xiAPI: DISABLE SENSOR
xiAPI: ENABLE SENSOR
xiAPI: SetDataRate bandwidth 2774; real band 2774; Freq 54; XSM 10
xiAPI: ERROR: pixel -7x323 has no correction pixel!
xiAPI: ERROR: pixel -7x1018 has no correction pixel!
xiAPI: ERROR: 2 pixels in list without any correction!
xiAPI: SetDataRate bandwidth 2774; real band 2774; Freq 54; XSM 10
xiAPI: ERROR: pixel -7x323 has no correction pixel!
xiAPI: ERROR: pixel -7x1018 has no correction pixel!
xiAPI: ERROR: 2 pixels in list without any correction!
xiAPI: CalculateResources : Context B2AE4000 ID 14510651 m_maxBytes=1024 m_maxBufferSize=1048576
xiAPI: StartVideoStream
xiAPI: Failed to change thread scheduler, check user limit for realtime priority.
xiAPI: WorkerThread is up
xiAPI: ERROR: pixel -7x323 has no correction pixel!
xiAPI: ERROR: pixel -7x1018 has no correction pixel!
xiAPI: ERROR: 2 pixels in list without any correction!
Aborted

I have also tried xiAPI example, then I get black or white screens depending on light intensity. What can be the problem? Thank you.

Further Info:

Installed XIMEA Linux Software Package, and OpenCV according to descriptions. Using s-link USB 4 port 3.0 Hub.

Output of lsusb:

Bus 002 Device 006: ID 20f7:3001  
Bus 001 Device 006: ID 09da:000a A4 Tech Co., Ltd Optical Mouse Opto 510D
Bus 001 Device 005: ID 046e:52cc Behavior Tech. Computer Corp. 
Bus 002 Device 002: ID 05e3:0612 Genesys Logic, Inc. 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Info in usbview:

www.ximea.com
Manufacturer: XIMEA
Speed: unknown
USB Version:  3.00
Device Class: 00(>ifc )
Device Subclass: 00
Device Protocol: 00
Maximum Default Endpoint Size: 9
Number of Configurations: 1
Vendor Id: 20f7
Product Id: 3001
Revision Number:  0.00

Config Number: 1
    Number of Interfaces: 1
    Attributes: 80
    MaxPower Needed: 400mA

    Interface Number: 0
        Name: (none)
        Alternate Number: 0
        Class: ff(vend.) 
        Sub Class: 00
        Protocol: 00
        Number of Endpoints: 4

            Endpoint Address: 81
            Direction: in
            Attribute: 2
            Type: Bulk
            Max Packet Size: 1024
            Interval: 0ms

            Endpoint Address: 02
            Direction: out
            Attribute: 2
            Type: Bulk
            Max Packet Size: 1024
            Interval: 0ms

            Endpoint Address: 82
            Direction: in
            Attribute: 2
            Type: Bulk
            Max Packet Size: 1024
            Interval: 0ms

            Endpoint Address: 83
            Direction: in
            Attribute: 2
            Type: Bulk
            Max Packet Size: 1024
            Interval: 0ms

Solution

  • I do not know, how ximea and opencv goes to together.

    I am only using the ximea api and it works.

    Your problem "xiAPI: Failed to change thread scheduler, check user limit for realtime priority." means: Your process has not the right to set the scheduling policy/priority. You can change this by running the process as root. Or you can set it in the attributes of the file (you need root rights to do so), e. g. Why does `sched_setscheduler()` require root priveledges?

    setcap cap_sys_nice+ep ./your_program
    

    I think your other problems like "ERROR: pixel -7x323 has no correction pixel!" with the BPL file stored in the camera. It defines damaged pixels, which should be corrected (bad pixel correction). In the ximea api you can switch this correction off, see ximea: Sensor Defects Correction parameters.