0

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!

riku_zac
  • 55
  • 4
  • What are `model.predict`, `voc_colormap` and `vis_bbox` please? – Mark Setchell Mar 12 '20 at 08:55
  • What do you mean by 'without the white background" ? You want to remove the white bands around the figure ? Have a look here https://stackoverflow.com/questions/8218608/scipy-savefig-without-frames-axes-only-content/8218887#8218887 – Liris Mar 12 '20 at 11:40

0 Answers0