Closed Anadelphia closed 3 years ago
i found it this way
/*
template<int SRC_T=TYPE_BINARY, int IN_ROWS, int IN_COLS, int IN_NPC> void RoiExtraction(xf::Mat<SRC_T, IN_ROWS, IN_COLS, IN_NPC> &xfMat_In, xf::Mat<SRC_T, IN_ROWS, IN_COLS, IN_NPC> &xfMat_Out) {
uint16_t image_width = xfMat_In.cols >> XF_BITSHIFT(IN_NPC);
uint16_t image_height = xfMat_In.rows;
XF_PTNAME(XF_DEPTH(SRC_T,IN_NPC)) in_pix;
XF_PTNAME(XF_DEPTH(SRC_T,IN_NPC)) out_pix;
uint8type data;
int32_t x_calc_r,x_calc_l;
uint32_t y_calc;
loop_xy_roi_in: for(uint16_t row = 0; row < image_height; row++) {
for(uint16_t col = 0; col < image_width; col++)
{
if(row>216)
{
x_calc_l=(col*-1)+720;
x_calc_r=col+80;
y_calc= 2*row;
if(y_calc>x_calc_l && y_calc>x_calc_r) out_pix = xfMat_In.read(row*image_width+col);
else out_pix.range(7, 0) = (unsigned char)0x00;
}
else out_pix.range(7, 0) = (unsigned char)0x00;
xfMat_Out.write(row*image_width+col,(out_pix));
}
}
}
I was wondering if i could create a mask for extracting ROI from my original image, i need to create a trapezoidal shape in my mask image and bit-wise_and it with my binary original image for extracting ROI. or any suggestion for creating trapezoidal shape in my original image?
i found something like xf::Window but i'm not sure i can either use it for this purpose or not ? os: Windows / Vivado HLS 2019.1