Backgroup:
I want to tranfer the binary bytes image to python services from other services with grpc protocol. and the python service will handle the image in opencv lib. I download the image from other serivces and send image data from memory to python services.
The question is how to efficiently convert binary bytes image to opencv in python.?
before python services.
It read image from local path. the type of img is numpy.ndarray
img = cv2.imread(img_path)
img = cv2.resize(img, (224,224))
I wish be that as follow, and how to implement convert function efficiently and simply!
img = convert(image) #image is the binary bytes image from grpc protocol
img = cv2.resize(img, (224,224))
here some similar problem. but it read data from local and convert to opencv.
ref:
note: I am newer to python
the version of python is python3