>>135
この部分を
byte_image = cv2.imencode(".jpg", im)
これに
_, byte_image = cv2.imencode(".jpg", im)