How to use onboard camera on TX2 dev kit with Visionworks 1.6? (Jetpack 3.1)

Hi,
I am trying to use onboard camera on TX2 with Visionworks.
I have some difficulties in running samples with the link:

./nvx_demo_video_stabilizer --source="device:///nvcamera?index=0" or ./nvx_demo_video_stabilizer --source=“device:///nvcamera”

the answer :

VisionWorks library info:
VisionWorks version : 1.6.0
OpenVX Standard version : 1.1.0

Error: Can’t open source file: device:///nvcamera?index=0

I know it is not provide in user guide how to use onboard camera or another one, but I am still trying to found a solution.
Could someone help me ?

here is the part of the mainfile which concern my aim:

    nvxio::Application &app = nvxio::Application::get();
    ovxio::printVersionInfo();

    //
    // Parse command line arguments
    //

    std::string videoFilePath = app.findSampleFilePath("parking.avi");
    unsigned numOfSmoothingFrames = 5;
    float cropMargin = 0.07f;

    app.setDescription("This demo demonstrates Video Stabilization algorithm");
    app.addOption('s', "source", "Input URI", nvxio::OptionHandler::string(&videoFilePath));
    app.addOption('n', "", "Number of smoothing frames",
                  nvxio::OptionHandler::unsignedInteger(&numOfSmoothingFrames, nvxio::ranges::atLeast(1u) & nvxio::ranges::atMost(6u)));
    app.addOption(0, "crop", "Crop margin for stabilized frames. If it is negative then the frame cropping is turned off",
                  nvxio::OptionHandler::real(&cropMargin, nvxio::ranges::lessThan(0.5f)));
    app.init(argc, argv);

    //
    // Create OpenVX context
    //

    ovxio::ContextGuard context;
    vxRegisterLogCallback(context, &ovxio::stdoutLogCallback, vx_false_e);
    vxDirective(context, VX_DIRECTIVE_ENABLE_PERFORMANCE);

    //
    // Create FrameSource and Render
    //

    std::unique_ptr<ovxio::FrameSource> source(
        ovxio::createDefaultFrameSource(context, videoFilePath));

    if (!source || !source->open())
    {
        std::cerr << "Error: Can't open source file: " << videoFilePath << std::endl;
        return nvxio::Application::APP_EXIT_CODE_NO_RESOURCE;
    }

    if (source->getSourceType() == ovxio::FrameSource::SINGLE_IMAGE_SOURCE)
    {
        std::cerr << "Error: Can't work on a single image." << std::endl;
        return nvxio::Application::APP_EXIT_CODE_INVALID_FORMAT;
    }

    ovxio::FrameSource::Parameters sourceParams = source->getConfiguration();

    vx_int32 demoImgWidth = 2 * sourceParams.frameWidth;
    vx_int32 demoImgHeight = sourceParams.frameHeight;

    std::unique_ptr<ovxio::Render> renderer(ovxio::createDefaultRender(
        context, "Video Stabilization Demo", demoImgWidth, demoImgHeight));

    if (!renderer)
    {
        std::cerr << "Error: Can't create a renderer" << std::endl;
        return nvxio::Application::APP_EXIT_CODE_NO_RENDER;
    }

    EventData eventData;
    renderer->setOnKeyboardEventCallback(eventCallback, &eventData);

    //
    // Create OpenVX Image to hold frames from video source
    //

    vx_image demoImg = vxCreateImage(context, demoImgWidth,
                                   demoImgHeight, VX_DF_IMAGE_RGBX);
    NVXIO_CHECK_REFERENCE(demoImg);

I tryed to use :
app.addOption(‘c’, “camera”, “Input camera device ID”,nvxio::OptionHandler::unsignedInteger(&cameraID,nvxio::ranges::atMost(1u)));

without success :/

may I just be wrong when use the link :
–source=“device:///nvcamera?index=0”

So I need someone help…

When I use : --source=“device:///v4l2?index=0”
the demo is running but with a black screen display…
Do you have an explanation???

Hi,

On-board camera should open with nvcamerasrc. We are checking this issue.
Will update information to you soon.

Thanks.

Thank you for your answer.
For information, the on-board camera can run with the command : gst-launch-1.0 nvcamerasrc …
But I try to run it from Visionworks samples and demos

Regards

Hi,
I am still looking for a solution (@Aastall)
I still have jetpack 3.1 on my dev kit and v4l2 seems not running…
I tryed to launch my on board camera with the command :gst-launch-1.0 v4l2 …
NO SUCCESS
And when we use the source, the pipeline is defined in the file :
~VisionWorks-1.6-Samples/nvxio/src/NVX/FrameSource/GStreamer/GStreamerCameraFrameSourceImpl.cpp
In this file, we have the launch parameters with v4l2!!!

Still need you!!

Regards

Hi,

v4l2 is for USB-camera. We need to open onboard camera with nvcamerasrc.

From the document, VisionWorks only support the TX1 onboard camera, but we are checking if it is possible to open TX2 onboard camera as well.
Thanks.

I too facing the same problem.

Did you find fix for onboard camera to work on TX2 with VisionWorks? Quick reply would be greatly appreciated. Thanks.

Currently, onboard camera is not working with VisionWorks on TX2.
We are debugging this issue. Will update information to you once we have.

Thanks and sorry for the inconvience.

Hi, yes, I did.
I fixed the problem with some modification in the libraries of the file named “nvxio”.
When you use the same call as in the demo/sample code (by passing in shell: ./file.exe --source=“device:///v4l2?index=0”), with the code I modified.

I modified the pipeline creation (with nvcamerasrc) and the buffer access memory (I had for a long time a segmentation fault core dumpt due to a bad access memory …) for GStreamer use

Please find in attachment my solution. If you find some improvment, please share your solution.

All you have to do is :
-dowonload the file “GStreamerCameraFrameSourceImpl.cpp”
-copy and past this file in the architecture : ~/VisionWorks-1.6-Samples/nvxio/src/NVX/FramesourceGStreamer
(or ProjectName/nvxio/src/NVX/FramesourceGStreamer)
-command make in the project
-command ./file.exe --source=“device:///v4l2?index=0” in the folder bin/…/

I hope my code and my information will help you!

GStreamerCameraFrameSourceImpl.cpp (12 KB)

Thanks, BaptSau!!

I will feedback your fix to the VisionWorks team.
Thanks a lot and sorry for the inconvenience.

Has this been fixed yet in JetPack?

Hi,

This issue is fixed in JetPack3.2 DP.
Thanks.

Hi,

I’m using Jetpack 4.2 with TX2 and there’s still an error after doing what BaptSau said.

./nvx_demo_motion_estimation --source="device:///v4l2?index=0"

Error:

VisionWorks library info:
                 VisionWorks version : 1.6.0
                 OpenVX Standard version: 1.1.0

camera index 0
gstreamer decoder failed to create pipeline
Error: cannot open frame source!

Hi,

VisionWorks only supports CSI camera.
For V4L camera, you will need to implement it on your own.

Please check this for more information:
https://devtalk.nvidia.com/default/topic/1051019/jetson-agx-xavier/visionworks-1-6-samples-issue/post/5337328/#5337328

Thanks.