Skip to content Skip to sidebar Skip to footer

Displaying Opencv Image Using Python Flask

I'm doing some processing on an image using opencv and using the python flask api. I'd like to display the image in the browser. import cv2 from flask import Flask, request, make_

Solution 1:

As mentioned in the comments, you need to return the bytes of an image, not a base64 string.

Try the following:

retval, buffer = cv2.imencode('.png', output_img)
response = make_response(buffer.tobytes())

Post a Comment for "Displaying Opencv Image Using Python Flask"