Nadav.
def shift(xy):
return xy+10
from skimage.transform import warp
from skimage.transform import warp
camera = samples.camera()
warp(camera, shift, output_shape=camera.shape)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)/home/nadav/pyscripts/<ipython-input-11-ce1e92562ac8> in <module>()
----> 1 warp(camera, shift, output_shape=camera.shape)
/usr/lib64/python3.2/site-packages/scikits_image-0.6dev-py3.2-linux-x86_64.egg/skimage/transform/_warp.py in warp(image, reverse_map, map_args, output_shape, order, mode, cval)
92
93 # Place the y-coordinate mapping
---> 94 _stackcopy(coords[1, ...], tf_coords[0, ...])
95
96 # Place the x-coordinate mapping
/usr/lib64/python3.2/site-packages/scikits_image-0.6dev-py3.2-linux-x86_64.egg/skimage/transform/_warp.py in _stackcopy(a, b)
23
24 """
---> 25 a[:] = b[:, :, np.newaxis]
26
27 def warp(image, reverse_map, map_args={},
ValueError: output operand requires a reduction, but reduction is not enabled
Nadav
It solves the problem.
What do you think about letting enabling output_shape=(m,n) even for a colour image, implicitly assuming that the 3rd dimension is copied from the original image.
Nadav
2012/5/16 Tony Yu <tsy...@gmail.com>On Wed, May 16, 2012 at 1:45 AM, Nadav Horesh <nadavh...@gmail.com> wrote:
It solves the problem.
What do you think about letting enabling output_shape=(m,n) even for a colour image, implicitly assuming that the 3rd dimension is copied from the original image.
NadavCurrently, color images work fine when no `output_shape` is specified. I'm not sure what you mean by "implicitly assuming that the 3rd dimension is copied from the original image". Are you suggesting that for color images setting `output_shape=(m, n)` should actually return a shape of `(m, n, 3)`? If that's the case, I strongly disagree because it seems magical---i.e. it's contradicting the user's command.Actually, I don't understand the use case for `output_shape`, so I could be missing something...-Tony
The warp mapping usually define an image of a different size than the original. The common case is that the distortion corrected image is cliped to the original image size, this is why that this is the default. However, one may want to see the full details of the original image, and thus specify output_shape > image.shape.
You got me right about the implicit dimension. The logic: The image size is the number of pixels, disregarding the colour depth. You are right if you consider the image as an array of values, but if you consider it as an image, the image shape is just the first 2 dimensions. Anyway it is not that important.
Thank you,
Nadav.