Norman, do you have a recommended library to do that?  Like Exiv2?

Joshua Jackson, PhD
Senior ResearchEngineer
 (800) 604-1822 Ext. 5109 <tel:8006041822,5109>   (256) 648-5109 
<tel:2566485109>
 [email protected] <mailto:[email protected]>   www.nSide.io
 <http://www.nside.io/> 4031 Parkway Dr, Suite B, Florence, AL 35630
  <http://www.linkedin.com/company/nside/>  <http://twitter.com/nSide__Out>
> On Apr 15, 2015, at 2:52 PM, Norman Barker <[email protected]> wrote:
> 
> A JP2 is just a JPEG2000 codestream with a JPEG2000 header, as soon as you 
> get to the SOC marker then you have all the metadata. Alternatively you could 
> use the JPX file format to store the metadata separately to the codestream.
> 
> I probably wouldn't use GDAL for this task, just read the metadata until you 
> hit the SOC marker.
> 
> 
> Norman
> 
> On Wed, Apr 15, 2015 at 1:46 PM, Dr. Joshua Jackson <[email protected] 
> <mailto:[email protected]>> wrote:
> I’m looking for a good solution to copy the image meta data from one JP2 to 
> another JP2 in C++.  I have a folder full of 4096x4096 JPEG2000 images that I 
> am processing with OpenCV.  On some of them I create a copy of the image and 
> do some manipulations to.  As expected the new image file is missing all the 
> metadata.
> 
> I have tried using CreateCopy() with the OpenJPEG library; and while this 
> does work it takes a really long time per image ~40sec.  (My image 
> manipulations take only ~10sec).
> 
> Is there some way to use the GetGDALDataSet() on the source file and then 
> call SetMetaData() on the destination file for each meta data item?  How 
> would one iterate through the metadata items?
> 
> Here is a sample GDALInfo printout for a source image:
> 
> Driver: JP2OpenJPEG/JPEG-2000 driver based on OpenJPEG library
> Files: middle_mask.jp2
> Size is 4096, 4096
> Coordinate System is:
> GEOGCS["WGS 84",
>     DATUM["WGS_1984",
>         SPHEROID["WGS 84",6378137,298.257223563,
>             AUTHORITY["EPSG","7030"]],
>         AUTHORITY["EPSG","6326"]],
>     PRIMEM["Greenwich",0],
>     UNIT["degree",0.0174532925199433],
>     AUTHORITY["EPSG","4326"]]
> Origin = (-96.965332031250000,32.464599609375000)
> Pixel Size = (0.000001341104507,-0.000001341104507)
> Image Structure Metadata:
>   INTERLEAVE=PIXEL
> Corner Coordinates:
> Upper Left  ( -96.9653320,  32.4645996) ( 96d57'55.20"W, 32d27'52.56"N)
> Lower Left  ( -96.9653320,  32.4591064) ( 96d57'55.20"W, 32d27'32.78"N)
> Upper Right ( -96.9598389,  32.4645996) ( 96d57'35.42"W, 32d27'52.56"N)
> Lower Right ( -96.9598389,  32.4591064) ( 96d57'35.42"W, 32d27'32.78"N)
> Center      ( -96.9625854,  32.4618530) ( 96d57'45.31"W, 32d27'42.67"N)
> Band 1 Block=1024x1024 Type=Byte, ColorInterp=Red
>   Overviews: 2048x2048, 1024x1024, 512x512, 256x256
>   Overviews: arbitrary
> Band 2 Block=1024x1024 Type=Byte, ColorInterp=Green
>   Overviews: 2048x2048, 1024x1024, 512x512, 256x256
>   Overviews: arbitrary
> Band 3 Block=1024x1024 Type=Byte, ColorInterp=Blue
>   Overviews: 2048x2048, 1024x1024, 512x512, 256x256
>   Overviews: arbitrary
> 
> 
> Joshua Jackson, PhD
> Senior ResearchEngineer
>  (800) 604-1822 Ext. 5109 <tel:8006041822,5109>   (256) 648-5109 
> <tel:2566485109>
>  [email protected] <mailto:[email protected]>   www.nSide.io <http://www.nside.io/>
>  <http://www.nside.io/> 4031 Parkway Dr, Suite B, Florence, AL 35630
>   <http://www.linkedin.com/company/nside/>  <http://twitter.com/nSide__Out>
> 
> _______________________________________________
> gdal-dev mailing list
> [email protected] <mailto:[email protected]>
> http://lists.osgeo.org/mailman/listinfo/gdal-dev 
> <http://lists.osgeo.org/mailman/listinfo/gdal-dev>
> 

_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to