cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
anuragkush
Contributor
Contributor
2,915 Views
Registered: ‎01-22-2018

Getting error: no match for 'operator >>'

Jump to solution
While running the attached code to copy pixel from image to a variable, I am getting the error: "error: no match for 'operator>>' " Even though the same operator is working in Sobel xapp1167. I have copied all the pragmas and include files as it is. Also, can you tell me exactly what this operator does? According to my understanding, it pushes pixel from image to variable in raster scanning form.
0 Kudos
1 Solution

Accepted Solutions
khareashish_trimble
Adventurer
Adventurer
3,271 Views
Registered: ‎10-17-2017

@anuragkush - your Mat is of type - HLS_8UC3 which means it has 3 channels. Each pixel in your Mat is represented by 3 eight bit unsigned numbers. 

 

Whereas your PIXEL_TYPE is only 1 channel . Each pixel is only 1 eight bit unsigned number-  typedef hls::Scalar< 1, unsigned char> PIXEL_TYPE;

 

 

Are you reading in an RGB/YUV image or a Grayscale image ? 

 

You would need to change either your MAT type or the pixel type. 


View solution in original post

0 Kudos
6 Replies
khareashish_trimble
Adventurer
Adventurer
2,874 Views
Registered: ‎10-17-2017

@anuragkush - Its likely that the pixels on the MAT_IMAGE is not of the type PIXEL_TYPE. Or that MAT_IMAGE is not defined correctly ? 

 

would be easier to figure out if you can share top.h

 

 

the >> and << operator are defined in hls_video_core.h as follows : 

 

Untitled.jpg

 

they are doing nothing but read/write from/to axi_stream 

 

in your code when you do : 

 

src >> in_pix;

 

it is essentially equivalent to in_pix = src.read(); 

 

It is reading the next pixel on the src axi stream. 

 

 

 

0 Kudos
anuragkush
Contributor
Contributor
2,856 Views
Registered: ‎01-22-2018

Hi @khareashish_trimble, Thanks for the clarification. My top.h is as follows:

 

 

#ifndef _TOP_H
#define _TOP_H

#include <hls_stream.h>
#include "hls_video.h"

// maximum image size
#define MAX_WIDTH 320
#define MAX_HEIGHT 240


typedef hls::stream<ap_axiu<24,1,1,1> > AXI_IN_STREAM;
typedef hls::stream<ap_axiu<24,1,1,1> > AXI_OUT_STREAM;
typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC3> MAT_IMAGE;
typedef hls::Scalar<1, unsigned char> PIXEL_TYPE;
void image_filter(AXI_IN_STREAM &input_1, AXI_OUT_STREAM &output_1, unsigned int cols, unsigned int rows);

#endif

 

0 Kudos
khareashish_trimble
Adventurer
Adventurer
3,272 Views
Registered: ‎10-17-2017

@anuragkush - your Mat is of type - HLS_8UC3 which means it has 3 channels. Each pixel in your Mat is represented by 3 eight bit unsigned numbers. 

 

Whereas your PIXEL_TYPE is only 1 channel . Each pixel is only 1 eight bit unsigned number-  typedef hls::Scalar< 1, unsigned char> PIXEL_TYPE;

 

 

Are you reading in an RGB/YUV image or a Grayscale image ? 

 

You would need to change either your MAT type or the pixel type. 


View solution in original post

0 Kudos
anuragkush
Contributor
Contributor
2,848 Views
Registered: ‎01-22-2018

Thank you so much. That solved the problem. The output is coming fine. But I am getting warnings.

 

Can you give an idea of this warning:

WARNING: Hls::stream 'hls::stream<unsigned char>.1' is read while empty, which may result in RTL simulation hanging.
WARNING: Hls::stream 'hls::stream<unsigned char>.2' is read while empty, which may result in RTL simulation hanging.
WARNING: Hls::stream 'hls::stream<unsigned char>.3' is read while empty, which may result in RTL simulation hanging.

It's repeating for the whole program and ends with:

WARNING: Hls::stream 'hls::stream<unsigned char>.6' contains leftover data, which may result in RTL simulation hanging.
WARNING: Hls::stream 'hls::stream<unsigned char>.5' contains leftover data, which may result in RTL simulation hanging.
WARNING: Hls::stream 'hls::stream<unsigned char>.4' contains leftover data, which may result in RTL simulation hanging.
0 Kudos
khareashish_trimble
Adventurer
Adventurer
2,843 Views
Registered: ‎10-17-2017

@anuragkush- Looks like there's a mismatch between the total number of pixels in the Mat and the number of pixels you are reading. 

anuragkush
Contributor
Contributor
2,834 Views
Registered: ‎01-22-2018

Oh yes. I just changed "maxrows+1" and"maxcols+1" to "maxrows" and "maxcols". Now I am not getting the warning.

0 Kudos