FastSAM icon indicating copy to clipboard operation
FastSAM copied to clipboard

MatplotlibDeprecationWarning: The tostring_rgb function was deprecated in Matplotlib 3.8 and will be removed two minor releases later. Use buffer_rgba instead. buf

Open pixkk opened this issue 1 year ago • 1 comments

File prompt.py:


        try:
            buf = fig.canvas.tostring_rgb()
        except AttributeError:
            fig.canvas.draw()
            buf = fig.canvas.tostring_rgb()
        cols, rows = fig.canvas.get_width_height()
        img_array = np.frombuffer(buf, dtype=np.uint8).reshape(rows, cols, 3)
        result = cv2.cvtColor(img_array, cv2.COLOR_RGB2BGR)
        plt.close()
        return result

pixkk avatar Jun 09 '24 15:06 pixkk

try: buf = fig.canvas.tostring_rgb() except AttributeError: fig.canvas.draw() buf = fig.canvas.tostring_rgb() cols, rows = fig.canvas.get_width_height() img_array = np.frombuffer(buf, dtype=np.uint8).reshape(rows, cols, 4) result = cv2.cvtColor(img_array, cv2.COLOR_RGB2BGR) plt.close() return result have a try

hjh530 avatar Sep 11 '24 11:09 hjh530