octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #42709] image package: imcrop returns an image


From: Carnë Draug
Subject: [Octave-bug-tracker] [bug #42709] image package: imcrop returns an image of the incorrect size
Date: Wed, 09 Jul 2014 11:05:23 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0 Iceweasel/30.0

Update of bug #42709 (project octave):

                  Status:               Need Info => Invalid                
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #3:

This is by design and not a bug. Also required for Matlab compatibility.
Basically this is because in RECT ([X_INI Y_INI WIDTH HEIGHT]), X_INI and
Y_INI are to be interpreted not as indexing but as coordinates (there is even
an option, not yet implemented, to change the coordinate system).

Let's for example assume the simplest example of RECT = [1 1 1 1]. This means
that using the standard system, you are not setting the left top coordinate of
the cropping rectangle to the top of element (1, 1), but to the center of that
rectangle (1.5, 1.5). Then, when you set WIDTH and HEIGHT both to 1, you set
the bottom right corner of the rectangle to (2.5, 2.5). Since imcrop() returns
any element that is only partially selected, it will return both the first and
second rows and columns. Try the following examples:


a = magic (4);
imcrop (a, [1 1 1 1]);
imcrop (a, [1 1 0.5 0.5]);
imcrop (a, [1 1 0.5-eps 0.5-eps])


I guess it could be made more clear on the documentation. Could you please
write a nicer explanation for this?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?42709>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]