My applications needs to send a gRPC request from the WPF program to the Python service, request data is an opencv mat The contents of my proto file are as follows:
Service gRPCRecognition {
Rpc Compare (CompareRequest) returns (CompareReply) {}
}
Message CompareRequest {
Bytes CurrImage = 1;
Bytes ToolImage = 2;
}
Message CompareReply {
Bool IsMatched = 1;
}
In the wpf program I use opencvsharp to get the CurrImage from the camera, and the ToolImage is read from the image file using opencvsharp. In the python server, opencv is used to process the business. How do I convert data on the client and server?
C# client code:
Private void sendRequest(Mat curr, Mat tool)
{
Var reply = client.Compare(new CompareRequest
{
CurrImage = // how to convert?
ToolImage = // how to convert?
});
}
python server code:
Class gRPCRecognition(Recognition_pb2_grpc.gRPCRecognitionServicer):
Def Compare(self, request, context):
Cv2.imshow('curr', /* how to convert */)
Cv2.imshow('user', /* how to convert */)