Remarks for transform.warp function
Tony Yu
tsyu80 at gmail.com
Wed May 16 10:10:43 EDT 2012
On Wed, May 16, 2012 at 1:45 AM, Nadav Horesh <nadavh.horesh at 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.
>
> Nadav
>
Currently, 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
Nadav: could you bottom-post or interleave
posts<http://en.wikipedia.org/wiki/Posting_style> to
the list---it helps when following long conversations.
>
> 2012/5/15 Tony Yu <tsyu80 at gmail.com>
>
>>
>>
>> On Tue, May 15, 2012 at 2:28 PM, Nadav Horesh <nadavh.horesh at gmail.com>wrote:
>>
>>> 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
>>>
>>
>>
>> Hi Nadav,
>>
>> Could you check to see if the fix in my fix-stack-copy solves your issues
>> (it should fix the example you gave above, but it sounds like you might
>> have other uses). You can either make changes<https://github.com/tonysyu/scikits-image/commit/048c6c06ebe9935aa6844a09ed85396c156befbd>to your local copy, or you can create a new branch based off of mine. I
>> think you mentioned that you're new to git so...
>>
>> Add my repo as a remote:
>> $ git remote add tonysyu git at github.com:tonysyu/scikits-image.git
>> Fetch my branches:
>> $ git fetch tonysyu
>> Create and checkout a new branch based off of my branch:
>> $ git checkout -b fix-stack-copy tonysyu/fix-stack-copy
>>
>> (Let me know if you have issues with the above---I'm working from memory,
>> so it may be flawed)
>>
>> Best,
>> -Tony
>>
>>
>>>
>>>
>>>
>>>
>>> 2012/5/15 Stéfan van der Walt <stefan at sun.ac.za>
>>>
>>>> Hi Nadav
>>>>
>>>> On Tue, May 15, 2012 at 7:24 AM, Nadav Horesh <nadavh.horesh at gmail.com>
>>>> wrote:
>>>> > Remarks for today's skimage snaphot:
>>>> >
>>>> > The documentation state that the input image is a 2D array. In
>>>> practice it
>>>> > can be a colour image.
>>>> > I got failures whenever I used the output_shape parameter
>>>>
>>>> What code are you referring to?
>>>>
>>>> Stéfan
>>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20120516/8c62fd18/attachment.html>
More information about the scikit-image
mailing list