-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Describe the question.
I’m interested in using the python API to decode a NITF file containing a very large image encoded with JPEG2000. A NITF is a container format, encapsulating a header and one or more images. When using JPEG2000 compression, image data is effectively a .jp2 file encapsulated within a larger NITF file.
I’m currently able to discover the extents of the encapsulated image data through other means, read the complete (very large) encoded image to a python variable as bytes, form a code stream from those encoded bytes, and then decode a numpy array for the small ROI I’m interested in. Unfortunately this is relatively inefficient as I have to read and store the complete encoded image just to decode a small portion.
One useful possibility would be a new code stream constructor that takes a file name, byte offset, and byte length. This would let me form a code stream from just the relevant JP2 portion of the encapsulating NITF without reading all bytes into memory.
Would such a constructor be possible? Or is there some other way to achieve decoding for a container format like NITF without reading the entire byte stream to memory?
Thanks in advance for any help!
Check for duplicates
- I have searched the open bugs/issues and have found no duplicates for this bug report