SynthText_Chinese_version icon indicating copy to clipboard operation
SynthText_Chinese_version copied to clipboard

how can i solve this problem

Open A-bone1 opened this issue 7 years ago • 2 comments

File "gen.py", line 142, in main img_resize=img.resize(db['depth'][imname].shape) File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1745, in resize return self._new(self.im.resize(size, resample, box)) TypeError: argument 1 must be sequence of length 2, not 3

A-bone1 avatar Jan 21 '18 09:01 A-bone1

It's stated in your log, Image resize function only accept tuple-2, it won't be happy to take tuple-3 (if you print the shape, you will see db['depth'][imname] is depth * width * height, rather than width * height).

I attempted to use .shape[1:] to sort this out, however, it was not happy about it whatsoever. So what I did to tackle this problem was converting img to numpy format, and utilised opencv cv2.resize function to resize the raw image.

Hope it gives some help. I had other headache trying to make it opencv3.3 friendly, and still working on it.

Good luck. Hanyi Hu

hh2712 avatar Jan 25 '18 03:01 hh2712

#2 here is the solution

img_resize=img.resize(db['depth'][imname].shape[1:3])

FoxerLee avatar Apr 17 '18 03:04 FoxerLee