如何冲洗hls :: Mat?

时间:2019-03-26 05:27:43

标签: c++ hls scalar vivado

我需要将两个图像(hls :: Mat)的上半部分堆叠在一起。我最终遇到以下错误。

  

警告:Hls :: stream'hls :: stream.8'包含剩余数据,可能会导致RTL仿真挂起。

如果我用

冲洗剩余的食物
while (1){
    img_in0 >> p0;
    if (!p0.val[0])
        break;
}

我遇到以下错误

  

警告:为空时读取Hls :: stream'hls :: stream.7',这可能会导致RTL仿真挂起。

我想知道冲洗剩菜的最佳方法是什么?

#define NO_PREFILTER

#include "stereo_top.h"

void combine2(
        GRAY_IMAGE& img_in0,
        GRAY_IMAGE& img_in1,
        GRAY_IMAGE& img_out,
    int rows,
    int cols) {

hls::Scalar<1, unsigned char> p0, p1, p;


L_row: for(int row = 0; row < rows; row++) {
#pragma HLS LOOP_TRIPCOUNT min=1 max=1080

    L_col: for(int col = 0; col < cols; col++) {
    #pragma HLS LOOP_TRIPCOUNT min=1 max=1920
    #pragma HLS pipeline rewind
        if(row<(rows/2)) {
            img_in0 >> p0;
            p = p0;
        }
        else
        {
            img_in1 >> p1;
            p = p1;
        }
        img_out << p;
    }

}

while (1){
    img_in0 >> p0;
    if (!p0.val[0])
        break;
}

}

void stereo_filter_lr(AXI_STREAM& imgLeft_axi, AXI_STREAM& imgRight_axi, AXI_STREAM& stereoOut, int rows, int cols)
{
#pragma HLS INTERFACE axis port=imgRight_axi
#pragma HLS INTERFACE axis port=imgLeft_axi
#pragma HLS INTERFACE ap_none port=cols
#pragma HLS INTERFACE ap_none port=rows

RGB_IMAGE   imgL_0(rows, cols);
RGB_IMAGE   imgR_0(rows, cols);
GRAY_IMAGE  img_L(rows, cols);
GRAY_IMAGE  img_R(rows, cols);
GRAY_IMAGE  disp(rows, cols);
RGB_IMAGE           stereo(rows, cols);

#pragma HLS dataflow

    //Recieve data stream and convert to Mat format
    hls::AXIvideo2Mat(imgLeft_axi, imgL_0);
    hls::AXIvideo2Mat(imgRight_axi, imgR_0);

    //Convert RGB Image to Gray Image
    hls::CvtColor<HLS_BGR2GRAY>(imgL_0, img_L);
    hls::CvtColor<HLS_BGR2GRAY>(imgR_0, img_R);

    combine2(img_L, img_R, disp, rows, cols);

    hls::CvtColor<HLS_GRAY2BGR>(disp, stereo);
    hls::Mat2AXIvideo(stereo, stereoOut);
    return;
}

1 个答案:

答案 0 :(得分:0)

我相信您可以使用以下功能来消耗剩余数据:

hls::Consume()