VisionWorks graph not processing after first image

Hi,

I’m creating a pipeline from an OpenCV mat source and when I display the input to the pipeline, the input VX images display and update correctly, however the output VX images aren’t changing after using vxProcessGraph after the first image. All the kernels are performing their functions correctly when I display the first output image, its just that the graph doesn’t seem to update more than the first rectifified and network resized.

Constructor and the callback and method for display is below, I can post other snippets if needed for better insight. TIA

PROCESSOR_NVX::PROCESSOR_NVX(int width, int height, std::string source) :
PROCESSOR_BASE(width, height),
m_context(nullptr),
m_graph(nullptr)
{
// Build Pipeline
m_context = vxCreateContext();
vxDirective((vx_reference)m_context, VX_DIRECTIVE_ENABLE_PERFORMANCE);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_context));

m_graph = vxCreateGraph(m_context);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_graph));

vxRegisterLogCallback(m_context, &NVXLogCallback, vx_false_e);

// Determine input format from source
vx_df_image_e input_format;
if (source == "basler") { input_format = VX_DF_IMAGE_U8; imgBuffer.create(height, width * 2, CV_8UC1); }
else if (source == "video") { input_format = VX_DF_IMAGE_RGB; imgBuffer.create(height, width * 2, CV_8UC3);}

// Create combined image

// ROI Image Source
vx_imagepatch_addressing_t src_addr;
src_addr.dim_x = imgBuffer.cols;
src_addr.dim_y = imgBuffer.rows;
src_addr.stride_x = 3*sizeof(vx_uint8);
src_addr.stride_y = static_cast<vx_int32>(imgBuffer.step);

void *src_ptrs[] = {
    imgBuffer.data
};

// Create Image from source CV mat
m_raw_full = vxCreateImageFromHandle(m_context, VX_DF_IMAGE_RGB, &src_addr, src_ptrs, VX_MEMORY_TYPE_HOST);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_raw_full));

// Extract ROI dims of Full Image
vx_rectangle_t fullRect;
vxGetValidRegionImage(m_raw_full, &fullRect);

// Notify the framework that we are going to access imported images
vx_map_id raw_map_id;
void *raw_img_ptr;
vxMapImagePatch(m_raw_full, &fullRect, 0, &raw_map_id, &src_addr, &raw_img_ptr, VX_READ_ONLY, VX_MEMORY_TYPE_HOST, 0);
vxUnmapImagePatch(m_raw_full, raw_map_id);

// Define ROI for LHS and RHS Images
vx_rectangle_t leftRect;
leftRect.start_x = fullRect.start_x;
leftRect.start_y = fullRect.start_y;
leftRect.end_x = fullRect.end_x / 2;
leftRect.end_y = fullRect.end_y;

vx_rectangle_t rightRect;
rightRect.start_x = leftRect.end_x;
rightRect.start_y = fullRect.start_y;
rightRect.end_x = fullRect.end_x;
rightRect.end_y = fullRect.end_y;

// Create LHS and RHS Frames from Full Image
m_raw_left = vxCreateImageFromROI(m_raw_full, &leftRect);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_raw_left));
m_raw_right = vxCreateImageFromROI(m_raw_full, &rightRect);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_raw_right));

// Rectified Images
m_rectified_left = vxCreateImage(m_context, width, height, VX_DF_IMAGE_RGB);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_rectified_left));
m_rectified_right = vxCreateImage(m_context, width, height, VX_DF_IMAGE_RGB);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_rectified_right));

// Remapping Matricies
m_xmap_left = vxCreateMatrix(m_context, VX_TYPE_FLOAT32, width, height);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_xmap_left));
m_ymap_left = vxCreateMatrix(m_context, VX_TYPE_FLOAT32, width, height);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_ymap_left));

m_xmap_right = vxCreateMatrix(m_context, VX_TYPE_FLOAT32, width, height);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_xmap_right));
m_ymap_right = vxCreateMatrix(m_context, VX_TYPE_FLOAT32, width, height);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_ymap_right));

// Inference Matrix
m_networkResized = vxCreateImage(m_context, m_inputW, m_inputH, VX_DF_IMAGE_RGB);
VX_CHECK_STATUS(vxGetStatus((vx_reference)m_networkResized));

// Register Custom Kernels
registerdemosaicKernel(m_context);
registerRectificationKernel(m_context);

if (source == "basler")
{
    // Create RGB Images for Debayered Output
    m_demo_left = vxCreateImage(m_context, width, height, VX_DF_IMAGE_RGB);
    VX_CHECK_STATUS(vxGetStatus((vx_reference)m_demo_left));
    m_demo_right = vxCreateImage(m_context, width, height, VX_DF_IMAGE_RGB);
    VX_CHECK_STATUS(vxGetStatus((vx_reference)m_demo_right));

    // Debayer the Raw Images
    vx_node demosaic_left_node = demosaicNode(m_graph, m_raw_left, m_demo_left);
    VX_CHECK_STATUS(vxVerifyGraph(m_graph));
    vx_node demosaic_right_node = demosaicNode(m_graph, m_raw_right, m_demo_right);
    VX_CHECK_STATUS(vxVerifyGraph(m_graph));

    // Rectify the Debayered Images
    vx_node rectify_left_node = rectificationNode(m_graph, m_demo_left, m_xmap_left, m_ymap_left, m_rectified_left);
    VX_CHECK_STATUS(vxVerifyGraph(m_graph));
    vx_node rectify_right_node = rectificationNode(m_graph, m_demo_right, m_xmap_right, m_ymap_right, m_rectified_right);
    VX_CHECK_STATUS(vxVerifyGraph(m_graph));

    // Scale down RHS frame for Inference
    vx_node infer_resize_node = vxScaleImageNode(m_graph, m_rectified_right, m_networkResized, VX_INTERPOLATION_AREA);
    VX_CHECK_STATUS(vxVerifyGraph(m_graph));

    // Release Nodes
    vxReleaseNode(&demosaic_left_node);
    vxReleaseNode(&demosaic_right_node);
    vxReleaseNode(&rectify_left_node);
    vxReleaseNode(&rectify_right_node);
    vxReleaseNode(&infer_resize_node);
}
else if (source == "video")
{
    // Rectify raw camera images
    vx_node rectify_left_node = rectificationNode(m_graph, m_raw_left, m_xmap_left, m_ymap_left, m_rectified_left);
    VX_CHECK_STATUS(vxVerifyGraph(m_graph));
    vx_node rectify_right_node = rectificationNode(m_graph, m_raw_right, m_xmap_right, m_ymap_right, m_rectified_right);
    VX_CHECK_STATUS(vxVerifyGraph(m_graph));

    // Scale down RHS frame for Inference
    vx_node infer_resize_node = vxScaleImageNode(m_graph, m_rectified_right, m_networkResized, VX_INTERPOLATION_AREA);
    VX_CHECK_STATUS(vxVerifyGraph(m_graph));

    // Release Nodes
    vxReleaseNode(&rectify_left_node);
    vxReleaseNode(&rectify_right_node);
    vxReleaseNode(&infer_resize_node);
}
// Add Rectification Maps to vx_matrix
m_rectifier.get_rectify_map_host(left_x, left_y, right_x, right_y);
nvx_cv::copyCVMatToVXMatrix(left_x, m_xmap_left);
nvx_cv::copyCVMatToVXMatrix(left_y, m_ymap_left);
nvx_cv::copyCVMatToVXMatrix(right_x, m_xmap_right);
nvx_cv::copyCVMatToVXMatrix(right_y, m_ymap_right);

}

void PROCESSOR_NVX::ProcessFrame(struct threadCvBufferHost* doubleProcessFrame, const ros::Time frame_timestamp)
{
/* Main callback to do inference,stereo and any other processing on frame */
LATENCY_LOG(“frame-rcv”, frame_timestamp)
{
std::shared_lockstd::shared_mutex guard(doubleProcessFrame->mtx);
doubleProcessFrame->cond_bool_process = false;

    TIC("latency") //latency
        
    // Add the frames into the Pipeline
    doubleProcessFrame->img.copyTo(imgBuffer);
}

TIC("imageproc")
VX_CHECK_STATUS(vxProcessGraph(m_graph));
TOC("imageproc")




// cv::Mat test_img = nvx_cv::VXImageToCVMatMapper(m_raw_full, 0, NULL, VX_READ_ONLY, VX_MEMORY_TYPE_HOST).getMat();
cv::Mat left_img = nvx_cv::VXImageToCVMatMapper(m_rectified_left, 0, NULL, VX_READ_ONLY, VX_MEMORY_TYPE_HOST).getMat();
cv::Mat right_img = nvx_cv::VXImageToCVMatMapper(m_rectified_right, 0, NULL, VX_READ_ONLY, VX_MEMORY_TYPE_HOST).getMat();
// cv::Mat resize_img = nvx_cv::VXImageToCVMatMapper(m_networkResized, 0, NULL, VX_READ_ONLY, VX_MEMORY_TYPE_HOST).getMat();
// cv::Mat left_img = nvx_cv::VXImageToCVMatMapper(m_raw_left, 0, NULL, VX_READ_ONLY, VX_MEMORY_TYPE_HOST).getMat();
// cv::Mat right_img = nvx_cv::VXImageToCVMatMapper(m_raw_right, 0, NULL, VX_READ_ONLY, VX_MEMORY_TYPE_HOST).getMat();
if (DEVELOP){ // Defined in CMakeLists.txt
// Should disable when performance is critical. Drawing is compute intensive
cv::Mat combined_frame = (0.25 * left_img) + (0.75 * right_img);

    draw_boxes(combined_frame, filtered_bboxes);

    cv::imshow("window", combined_frame);
    cv::waitKey(1);
}

Resolved by removing copy to intermediate-middle-man cvMat and copying directly from shared buffer to vx_image memory.