I just figure that out, the set_data of bytes require you to specify the 
size.
Here is the correct way to do this.
image_results->set_data(buffer.data(), buffer.size());
On Friday, October 27, 2023 at 5:06:03 PM UTC+7 Tonson Praphabkul wrote:

> Hello Everyone
>
> This is the first time I work with c++ gRPC and I got this error when I 
> tried to set the "data" field.
>
> '''
>
> *error: *no matching function for call to 
> '*helper::Image::set_data(std::vector<unsigned 
> char>&)*'
>
>   314 |             image_results->set_data(buffer*)*;
>
> '''
>
>
> It's okay for another field that were int32.
>
>
> here is snippet of my photo files
>
>
> From helper files
>
>
> message Image {
> int32 rows = 1;
> int32 cols = 2;
> int32 channels = 3;
> bytes data = 4;
> ImageType type = 5;
> }
>
> From my proto files
> message InputImages {
> repeated helper.Image image = 1;
> helper.ImageType image_response_type = 2;
> float confThreshold = 3;
> float maskThreshold = 4;
> int32 camera_id = 5;
> helper.Rectangle detection_rect = 6;
> }
>
> How I declare buffer
> std::vector<uchar> buffer;
>
> The data inside buffer is get from cv::imencode()
>
> Is it's possible to use set_name method or do I need to use another way to 
> send bytes?
>
> Thank you for your attention.
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/40cf2134-21e4-4f2f-a534-b8614a8cbfedn%40googlegroups.com.

Reply via email to