bugGNU Octave - Bugs: bug #49456, imcrop not compatible with Matlab...

 
 

bug #49456: imcrop not compatible with Matlab when requested rectangle falls outside the image rectangle

Submitter:  None
Submitted:  Thu 27 Oct 2016 01:30:09 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Kustaa Nyholm Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * other
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 13 Nov 2016 12:33:04 PM UTC, comment #4: 

Thank you for the bug report and fix.  I have pushed the suggestion and added a series of tests to prevent this from happening again.

http://hg.code.sf.net/p/octave/image/rev/6cd0d6b5cc1e

You said:

> I've seen: http://savannah.gnu.org/bugs/?42709 but I'm not convinced.


Do you mean you are not convinced that it was an invalid bug? Can you please comment there if you think so with an example showing it?

Carnë Draug <carandraug>
Group Member
Sat 12 Nov 2016 06:11:36 PM UTC, comment #3: 

@Carnë:

Could you please fix imcrop in image repository?

Avinoam Kalma <avinoam>
Group Member
Thu 27 Oct 2016 02:01:02 PM UTC, comment #2: 

After lines 179-180 of imcrop.m


  i_ini = round ([rect(1) rect(2)]);
  i_end = round ([rect(1)+rect(3) rect(2)+rect(4)]);


there should be something like:


  i_ini = max(i_ini, [1 1]);
  i_end = min(i_end, [size(img, 1) size(img, 2)];



Anonymous
Thu 27 Oct 2016 01:33:04 PM UTC, comment #1: 

Oops sorry about misleading/erroneous title, wrote it before I had fully investigated the issue and now I can't change it.

A better title would have been "imcrop not compatible with Matlab when requested rectangle falls outside the image rectangle"

Anonymous
Thu 27 Oct 2016 01:30:09 PM UTC, original submission:  

function imcrop(image, [x_ini y_ini width height])

I've seen:
http://savannah.gnu.org/bugs/?42709
but I'm not convinced.

If I do in Octave:

M=magic(10);
S=imcrop(M,[1 1 10 10]);

I get:

error: imcrop: A(I,J,...): index to dimension 1 out of bounds; value 11 out of bound 10


If I do in Octave:

S=imcrop(M,[0 0 10 10]);

I get:

error: imcrop: subscript indices must be either positive integers less than 2^31 or logicals

In Matlab I get no error messages and I get back a matrix of elements from the intersection of the specified rectangle and the image bouding rectangle.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by avinoam
  • -email is unavailable- added by avinoam (Updated the item)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-13 carandraug StatusConfirmed Fixed
        Open/ClosedOpen Closed
        Release4.0.0 other
    2016-11-12 avinoam Carbon-Copy- Added -email is unavailable-
    2016-10-27 avinoam StatusNone Confirmed
        Operating SystemMac OS Any
        Summaryimcrop width height are off by one imcrop not compatible with Matlab when requested rectangle falls outside the image rectangle

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code