how to save figure in vis_bbox without white background, when plotting with matplotlib?

59 views Asked by At

i'm trying to save the image after vis_bbox prediction with its original image dimension.

my code:

from PIL import Image, ImageChops
import cv2

img = utils.read_image('/home/ubuntu/ui.jpg', color=True)
bboxes, labels,scores = model.predict([img])
bbox, label, score = bboxes[0], labels[0], scores[0],
colors = voc_colormap(label + 1)
bccd_labels = ('cell', 'cell')
vis_bbox(img, bbox,  label_names=bccd_labels, instance_colors=colors, alpha=0.9, linewidth=1.0)
plt.axis("off")


plt.savefig("/home/ubuntu/ins.jpg")

while saving , it saves the image with white background and default size (432 *288).

i need to save the predicted image from vis_bbox with the original dimension (1300 *1300).

Any suggestions would be helpful!

0

There are 0 answers