Skip to content Skip to sidebar Skip to footer

Conversion From Matlab To Python Of Repmat

I want to convert the given matlab code to python img_o = repmat(fill_value, osize); here fill_value is a 1x1x3 matrix and osize=[320 320] output matrix is 320x320x3 I have trie

Solution 1:

Numpy does some nonintuitive stuff that it nonintuitively calls "broadcasting". Here's what you need (just one more explicit dimension on your size vector):

>>> osize = (320, 320, 1)
>>> img_o = numpy.tile(fill_value, osize)
>>> img_o.shape
(320, 320, 3)

Post a Comment for "Conversion From Matlab To Python Of Repmat"