`
import numpy
import skimage.io
from skimage.transform import rotate
tr_1 = numpy.random.rand(5,300)
training_inputs = [numpy.reshape(tr_1[x,:], (3,10,10)) for x in range(len(tr_1))]
f = rotate(training_inputs[1], 90, resize=True)
上面的代码给出了大小为(10,4,10)的输出。但是图像应旋转,其大小应为(3,10,10)。
有什么建议以及如何进行代码处理?
skimage.rotate
无法旋转3波段图像。您必须一次旋转乐队。
import numpy as np
import skimage.io
from skimage.transform import rotate
tr_1 = numpy.random.rand(5,300)
training_inputs = [np.reshape(tr_1[x,:], (3,10,10)) for x in range(len(tr_1))]
f0 = rotate(training_inputs[1][0], 90, resize=True)
f1 = rotate(training_inputs[1][1], 90, resize=True)
f2 = rotate(training_inputs[1][2], 90, resize=True)
f = np.rollaxis(np.dstack((f0, f1, f2)), 2, 0)
的shape
的f
将是(3, 10, 10)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句