bugGNU Octave - Bugs: bug #37369, imread "Index" option is...

 
 

bug #37369: imread "Index" option is ignored (always returns first frame)

Submitter:  Carnë Draug <carandraug>
Submitted:  Sun 16 Sep 2012 05:32:21 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  carandraug
Originator Name:  Open/Closed:  * Closed
Release:  * 3.6.2 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 30 Jul 2013 12:06:51 PM UTC, comment #2: 

I have implemented this with cset 997efb8d0b19 and am closing this bug.

Carnë Draug <carandraug>
Group Member
Wed 28 Nov 2012 07:09:29 PM UTC, comment #1: 

So, I looked into the imread functionality a bit. Here is what I came up with.  The Matlab spec has the abbreviated functionality for imread for the different image formats that it supports:

BMP — Windows Bitmap

CUR — Cursor File
(..., idx)

GIF — Graphics Interchange Format
(..., idx) idx is a scalar integer or a vector of integer values
(..., 'frames', idx) same as above.  idx can be 'all'

HDF4 — Hierarchical Data Format
(..., ref) get the ref image.  not necessarily in order

ICO — Icon File

JPEG — Joint Photographic Experts Group

JPEG 2000 — Joint Photographic Experts Group 2000
(..., 'p1','v1','p2','v2',... )
'ReductionLevel' - non-negative integer
'PixelRegion' - {ROWS, COLS} - 2 element vectors representing [START, STOP]

PBM — Portable Bitmap

PGM — Portable Graymap

PNG — Portable Network Graphics
(..., 'BackgroundColor', BG ) - pretty complicated.

PPM — Portable Pixmap

RAS — Sun Raster

PCX — Windows Paintbrush

TIFF — Tagged Image File Format
(..., 'p1','v1','p2','v2',... )
'Index' -> integer for value
'Info' - structure from imfinfo - improves perf
'PixelRegion' - {ROWS, COLS} - 2 or 3 element vectors

XWD — X Window Dump

=================================

In the Octave code there seems to be very limited support for any of the additional functionality for the different formats. In fact the only additional functionality is the GIF support, 'frames' and 'all', which is transparently passed through to all formats.  It is not clear what GraphicsMagick does with the image index/number information on all formats. Probably ignores it.

My solution to the problem is to add a check for "Image" so that imread acts the same as if "frames" were passed in.

The default behaviour is to notice that there were 3 parameters passed in, but since the second was not "frames" silently error out and return the first image.  Unexpected behaviour is a poor user experience.



The only functionality seems to be
" (..., idx) " for all the format


Mark Wistrom <mwistrom>
Sun 16 Sep 2012 05:32:21 PM UTC, original submission:  

Hi

I have a multipage tiff whose pages I can read just fine if I pass their index as the second argument. However, if I specify the index thourgh the Index option, it completely ignores it and reads only the first frame. For example:


> a1 = imread (impath, 1); # reads first page just fine
> a2 = imread (impath, 2); # reads second page just fine
> b1 = imread (impath, "Index", 1); # reads first page
> b2 = imread (impath, "Index", 2); # also reads first page (wrong)
> isequal (b1, b2)
ans =  1
> isequal (a1, a2)
ans =  0


Carnë

Carnë Draug <carandraug>
Group Member

 

(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 mwistrom (Posted a comment)
  • -email is unavailable- added by carandraug (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-07-30 carandraug StatusNone Fixed
        Assigned toNone carandraug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code