rticommunity / rticonnextdds-usecases-automotive

This use case shows how Connext DDS can be used by Autonomous Vehicle developers to leverage RTI’s extensive experience with autonomous robotics, safety-critical systems and state-of-the-art architectures to simplify development, design and integration.
https://www.rti.com/resources/usecases/automotive
14 stars 16 forks source link

Reading and sending real camera data #8

Open Francisobiagwu opened 4 years ago

Francisobiagwu commented 4 years ago

I am using opencv to read camera image/saved image, and I am confused how to pass the image to the instance.

Eg:

include <opencv2/core/core.hpp>

include <opencv2/highgui/highgui.hpp>

include

using namespace cv; using namespace std;

Mat image; image = imread(argv[1], CV_LOAD_IMAGE_COLOR); // Read the file

if(! image.data )                              // Check for invalid input
{
    cout <<  "Could not open or find the image" << std::endl ;
    return -1;
}

from the rti-dds code: / Get a new sample before every write. This data sample can come from a free sample or a previously written sample which is ready for reuse. /

    retcode = CameraImage_CameraImageData_writer->get_loan(instance);
    if (retcode != DDS_RETCODE_OK) {
        fprintf(stderr, "CameraImage_CameraImageDataDataWriter_get_loan error(%s:%d)\n", __FILE__, __LINE__);
        publisher_shutdown(participant);
        return -1;
    }

how do provide this image/image properties to instance?