<< or write() not allowed with xf::Mat?

Hi, at the moment I am trying to convert an image to grayscale with a custom function. I am using my Pynq board, Vivado HLS 2018.3 and the xfOpenCV library, which says that ‘>>’ operator or write() is not available with xf::Mat. Could you please tell me how to change these instructions for another compatible on my below code?

void converttogrey(xf::Mat<TYPE, HEIGHT, WIDTH, NPC1> &img_in,xf::Mat<TYPE, HEIGHT, WIDTH, NPC1> &img_out){

RGB_PIX pin; // typedef xf::Scalar<3, unsigned char>
GREY_PIX pout; // typedef xf::Scalar<1, unsigned char>
Pixel grey_val; // integer 10 bits

L_row: for(int row = 0; row < 512; row++) {
#pragma HLS LOOP_TRIPCOUNT min=1 max=512
L_col: for(int col = 0; col < 512; col++) {
#pragma HLS LOOP_TRIPCOUNT min=1 max=512
#pragma HLS pipeline II=1 rewind

  	//img_in >> pin;	Format not valid with xfopencv library
  		   grey_val = const1 * pin.val[0] + const2 * pin.val[1] + const3 * pin.val[2];
  		   pout.val[0] = grey_val;
  		   pout.val[1] = grey_val;
  		   pout.val[2] = grey_val;
  	//img_out << pout;      Format not valid with xfopencv library}


I think you need to refer to page 10 of:

Operators from hls:Mat cannot be directly used as xf:Mat so you probably need some conversion as on Page 11.

Thank you for your reply, I have solved it but changing part of the code