Error when trying run argus soft

Hello!

I’m trying to make a program to capture frames from a CSI camera in C++ and pass the image to OpenCV for processing. I made CMake and program code. the program is built with CMake, but when it starts, an error occur.

Errors:
(Argus) Error InvalidState: (propagating from src/eglstream/FrameConsumerImpl.cpp, function streamEventThread(), line 135)
(Argus) Error InvalidState: (propagating from src/eglstream/FrameConsumerImpl.cpp, function streamEventThreadStatic(), line 177)

The error is on the next line:
frame_consumer_ = UniqueObj(FrameConsumer::create(stream_.get()));

CMake and attach the code. I can’t figure out what’s wrong.

JetPack 4.5.1 installed on Jetson.

CMakeLists.txt (979 Bytes)

argus_camera.cpp (2.5 KB)

hello rz.cross,

let’s narrow down the issue,
could you please confirm the camera streaming functionality.
here’s sample commands to disable preview and shows frame-rate only,
for example,
$ gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1920, height=1080, framerate=30/1, format=NV12' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=I420' ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 -v

Camera working:
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0: sync = false
Setting pipeline to PLAYING …
New clock: GstSystemClock
/GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
/GstPipeline:pipeline0/Gstnvvconv:nvvconv0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0.GstGhostPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
/GstPipeline:pipeline0/Gstnvvconv:nvvconv0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected…
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 1920 x 1080 FR = 29,999999 fps Duration = 33333334 ; Analog Gain range min 1,000000, max 31,622776; Exposure Range min 118000, max 33333000;

GST_ARGUS: Running with following settings:
Camera index = 0
Camera mode = 0
Output Stream W = 1920 H = 1080
seconds to Run = 0
Frame Rate = 29,999999
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0: sync = false
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 17, dropped: 0, current: 32,03, average: 32,03
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 32, dropped: 0, current: 29,93, average: 31,01
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 48, dropped: 0, current: 30,04, average: 30,68
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 63, dropped: 0, current: 29,99, average: 30,51

I think my CMake is incorrect, maybe the libraries are captured incorrectly?

hello rz.cross,

please also refer to /usr/src/jetson_multimedia_api/argus for readme file and steps to compile Argus samples.

Argus examples build and work, there are no errors. I wanted to create my code in my home directory (so I created my CMake from examples, main.cpp from examples). For some reason, all examples of argus ( /usr/src/jetson_multimedia_api/argus) work, my code displays an error.

hello rz.cross,

is your implementation has created this stream_ request as an output stream correctly?
you should also refer to… camera/argus/apps/camera/modules/tasks/ to review your application implementation.

Hello!

I thought to try running the 09_camera_jpeg_capture example in a loop. Can you explain how I could run the while example? At the moment only capture_time is used (sleep function):
/* Submit capture requests. */
PRODUCER_PRINT(“Starting repeat capture requests.\n”);
if (iCaptureSession->repeat(request.get()) != STATUS_OK)
ORIGINATE_ERROR(“Failed to start repeat capture request”);

/* Wait for CAPTURE_TIME seconds. */
 sleep(10);

hello rz.cross,

may I know what’s your expectation of your app implementation.
are you going to capture images continuously? did you try configure --cap-time to modify the capture time settings?

Hello,

I’m waiting for a program to capture and display an image using OpenCV. The “09_camera_jpeg_capture” example does a great job of this. But, you need to specify cap-time, which means that the program always has a limited life span, for example 30 seconds, and then the program closes. I want the program to run continuously until it receives a waitKey from the user to terminate. How can I do that?

hello rz.cross,

you may check below.
you could update the for loop by using do while loop; and exit the loop when keyevent has received.

    /* Wait for CAPTURE_TIME seconds. */
    for (uint32_t i = 0; i < CAPTURE_TIME; i++)
    {
        sleep(1);
        if (previewConsumerThread.errorStatus ||
            (DO_JPEG_ENCODE &&
            captureConsumerThread->errorStatus))
            break;
    }

Thanks,

CAPTURE_TIME in this case any value?

hello rz.cross,

you’ll understand it clearly by went-through the 09_camera_jpeg_capture sample code.

Hello,

I’ll check and get back with an answer in a while.

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.