[gdal-dev] Kakadu JP2 Output Overviews possible?

2012-07-11 Thread Zermeno, Robert J CIV NAVAIR, 472100D
GDAL Community,

I noticed GDAL has a utility program gdaladdo which embeds new overviews to a 
supplied file.  Does gdal have a utility program that allows me to extract 
overviews to a file?

If not, how would I be able to programmatically extract a specified overview 
within a JP2 image (using C/C++)?
What is the easiest way to get a reduced overview?

From your website I think there is two options:

1. Use GDALRasterIO() and set nBufXSize and nBufYSize to be smaller than the 
window size forcing GDAL to try and use a suitable overview as explained from:
  http://www.gdal.org/gdal_tutorial.html

OR:

1. Check if GDALGetOverviewCount()  0.  If true, then we have embedded 
overviews
2. Call GDALGetOverview(Band,1)  //For 1st overview band.  This will store the 
overview raster band in Band.  What happens if the image is RGB?  How do I 
obtain the R,G,B raster band of the overview at index 1?

3. Call GDALRasterBandXSize and GDALRasterBandYSize
4.  Once have all RasterBands and their sizes known, call GDALRasterIO to 
acquire the image.


How would you guys go about it?  I think I am on the right track.

Bob


smime.p7s
Description: S/MIME cryptographic signature
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] GDAL and Kakadu for MSVC2010 Building error

2012-07-09 Thread Zermeno, Robert J CIV NAVAIR, 472100D
Ladies and Gents,

I am upgrading my DLLs to all compile with the same CRT and trying to get GDAL 
to build with Kakadu for MSVC2010.  I have the latest GDAL SVN (7-8-2012) and 
kakadu v5.2.6.0 (I know it is older, but it works).  
I had to use MSVC2010 to update kakadu MSVC2005 and able to successfully build 
in both debug/release.

I am able to add kakadu to GDAL successfully in release mode, but always get an 
access violation error (MSVC brings up a malloc file) when performing a simple 
GDALOpen(jpip://ipAddress/file.jp2).  I want to see what problems are within 
GDAL but I need to have a debug version. 

Each time I try to add kakadu to GDAL in debug mode, I always get this type of 
error message:

Error LNK2038:mismatch detected for '_ITERATOR_DEBUG_LEVEL':value '0' doesn't 
match value '2' in cplkeywordparser.obj.
For files args.obj, palette.obj, and roi_sources.obj

Has anyone encountered this problem?  When I google online, people indicate it 
is a simple MSVC project upgrade problem when ITERATOR_DEBUG_LEVEL is not set.  
It is recommended to not use _SECURE_SCL and _HAS_ITERATOR_DEBUGGING.  When I 
build kakadu coresys (which generates kdu_v52R.dll) and all the required .obj 
files in apps projects, I add a preprocessor of ITERATOR_DEBUG_LEVEL=2

However, I still get the error when compiling both kakadu and GDAL.  Any 
suggestions you might recommend?

Thanks,
Bob




smime.p7s
Description: S/MIME cryptographic signature
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] Programmatically saving out a .tif file

2010-08-04 Thread Zermeno, Robert J CIV NAVAIR, 472100D
Hi everyone,

I know I am having a programming issues here because using GDAL apps provided, 
it outputs correctly.  I am using the SVN daily build of 7-21-2010 in Borland 
C++.

My issue: First, I converted the file , world.jp2, taken from 
http://www.microimages.com/gallery/jp2/ to TIF format via GDAL apps.  
Programmatically, I can read in this RGB image correctly.  The problem is 
saving it out programmatically.  My output results in an image that appears to 
having either missing information or somehow horizontal scanlines of black are 
inserted.  It looks like your looking at an old TV that visually shows the scan 
lines of the video feed.  It is consistent throughout the image.

I wish I can put up the image for you to see.  I do not have a host site or 
server to do so.

Solution:  Instead of keeping default CSLSetNameValue( pzOptions, INTERLEAVE, 
PIXEL ) , I change it to CSLSetNameValue( pzOptions, INTERLEAVE, BAND ).
  The output file is the same as the input file.  Only problem now is Microsoft 
Windows Picture and Fax Viewer can no longer read the image format.  I guess 
BAND interleave is a viable option, but not really used often.

Here are snippets of my code that will help explain what I am doing, and see if 
you guys can help me.  The problem with my solution is when using gdalinfo.exe 
on the file, original image INTERLEAVE = PIXEL and not BAND, so I want to spit 
out the same file in the same format.

PROGRAM:
//Retrieve the RGB colors
RedBand   = GDALGetRasterBand(fileDataset, 1);
GreenBand = GDALGetRasterBand(fileDataset, 2);
BlueBand  = GDALGetRasterBand(fileDataset, 3);
imageBits = (BYTE *) malloc(curGeoData-getImageWidth() *
 curGeoData-getImageHeight() *
curGeoData-getBitsPerPixel());

//Read in whole image: This example is for 1 scanLine read.  I have this in a 
For loop.



 RedError   =   GDALRasterIO( RedBand, 
GF_Read,
  0,
  curRow,
  curGeoData-getImageWidth(),
  1,
  RedStrip,
  curGeoData-getImageWidth(),
  1,
  GDT_Byte,
  0,
  0 );

 GreenError =   GDALRasterIO( 
GreenBand, GF_Read,
  0 ,
  curRow,
  curGeoData-getImageWidth(),
  1,
  GreenStrip,
  curGeoData-getImageWidth(),
  1,
  GDT_Byte,
  0,
  0 );

 BlueError  =   GDALRasterIO( BlueBand, 
GF_Read,
  0,
  curRow,
  curGeoData-getImageWidth(),
  1,
  BlueStrip,
  curGeoData-getImageWidth(),
  1,
  GDT_Byte,
  0,
  0 );

 if(RedError != CE_None || GreenError != CE_None || BlueError != 
CE_None)
 {
 //Error occured, return nothing to show error reading in 
bits...
 return NULL;
 }
//save out to output image buffer...
//Grab pixel per pixel
for(int col =0; col  curGeoData-getImageWidth(); col++)
{
imageBits[rawLoc++] = BlueStrip[col];
imageBits[rawLoc++] = GreenStrip[col];
imageBits[rawLoc++] = RedStrip[col];
}



//NOTE: as you can see, I have to place the pixels in BGRBGRBGRBGR in order for 
my Bitmap canvas to properly display.  Its not in RGBRGBRGB...

//NOW, Time to save out the FILE, this is just snippets not whole source...

GDALDriverH hDriver;
GDALDatasetH hDstDS;
if(imageBpp == 3)
{
//pzOptions = CSLSetNameValue( pzOptions, INTERLEAVE, PIXEL );

[gdal-dev] WinCE programming support

2010-08-04 Thread Zermeno, Robert J CIV NAVAIR, 472100D
Hi GDAL,

At my work, I have been assigned to support TIF images on Windows CE platform.  
My task is to support Pocket PC Arch. From 2002 to present.  So,
I am building from EVC 3.0 to MSVC 2005 with Windows Moblie 6.  I am using GDAL 
to accomplish this task.  Now, I noticed that no one is maintaining 
Support for it anymore.
I have taken the current SVN daily build and have successfully compiled GDAL 
for WinCE using Visual Studio 2005.  I would like to throw myself
Into the task in updating WinCE support.  What would I have to do to get 
approved to be on the team?

Thanks,

Robert


smime.p7s
Description: S/MIME cryptographic signature
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] GDAL, WinCE dll error when using in my own simple project

2010-06-22 Thread Zermeno, Robert J CIV NAVAIR, 472100D
I hope someone has remembered the capability issues concerning WinCE and GDAL 
(since its not really being maintained right now).  My issue is I am able to 
use the provided MSVC++ 2005 gdal project files and build the project to obtain 
a gdalce_i.lib and gdalce.dll files.

I created two projects, one in EVC4.0 and MSVC++ 2005 IDE.  Both compilers have 
provided me with the following error when I try to statically link the DLL and 
use:

#include gdal_priv.h

...
GDALAllRegister();

I followed the building and installation guide from: 
http://www.gdal.org/wince.html, and it all works, but
I get the following error messages when I try to use the DLL:

1-- Build started: Project: WinCE_G, Configuration: Debug Pocket PC 2003 
(ARMV4) --
1Compiling...
1cl : Command line warning D9035 : option 'GX' has been deprecated and will be 
removed in a future release
1cl : Command line warning D9025 : overriding '/GR-' with '/GR'
1stdafx.cpp
1Compiling...
1cl : Command line warning D9035 : option 'GX' has been deprecated and will be 
removed in a future release
1cl : Command line warning D9025 : overriding '/GR-' with '/GR'
1WinCE_G.cpp
1Linking...
1   Creating library Pocket PC 2003 (ARMV4)\Debug/WinCE_G.lib and object 
Pocket PC 2003 (ARMV4)\Debug/WinCE_G.exp
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual char 
const * __cdecl GDALMajorObject::GetDescription(void)const  
(?getdescript...@gdalmajorobject@@UBAPBDXZ)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual void 
__cdecl GDALMajorObject::SetDescription(char const *) 
(?setdescript...@gdalmajorobject@@uaax...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual char 
* * __cdecl GDALMajorObject::GetMetadata(char const *) 
(?getmetad...@gdalmajorobject@@uaapapad...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual enum 
CPLErr __cdecl GDALMajorObject::SetMetadata(char * *,char const *) 
(?setmetad...@gdalmajorobject@@UAA?AW4CPLErr@@papad...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual char 
const * __cdecl GDALMajorObject::GetMetadataItem(char const *,char const *) 
(?getmetadatai...@gdalmajorobject@@uaapbdp...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual enum 
CPLErr __cdecl GDALMajorObject::SetMetadataItem(char const *,char const *,char 
const *) (?setmetadatai...@gdalmajorobject@@UAA?AW4CPLErr@@pb...@z)
1WinCE_G.obj : error LNK2019: unresolved external symbol public: virtual 
__cdecl GDALMajorObject::~GDALMajorObject(void) (??1GDALMajorObject@@u...@xz) 
referenced in function public: virtual void * __cdecl GDALMajorObject::`scalar 
deleting destructor'(unsigned int) (??_GGDALMajorObject@@uaap...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol protected: virtual 
enum CPLErr __cdecl GDALDataset::IBuildOverviews(char const *,int,int *,int,int 
*,int (__cdecl*)(double,char const *,void *),void *) 
(?ibuildovervi...@gdaldataset@@MAA?AW4CPLErr@@pbdhpahh1p6ahn0...@z2@Z)
1WinCE_G.obj : error LNK2001: unresolved external symbol protected: virtual 
enum CPLErr __cdecl GDALDataset::IRasterIO(enum GDALRWFlag,int,int,int,int,void 
*,int,int,enum GDALDataType,int,int *,int,int,int) 
(?iraste...@gdaldataset@@MAA?AW4CPLErr@@W4GDALRWFlag@@PAXHHW4GDALDataType@@hpah...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual void 
__cdecl GDALDataset::FlushCache(void) (?flushca...@gdaldataset@@UAAXXZ)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual char 
const * __cdecl GDALDataset::GetProjectionRef(void) 
(?getprojection...@gdaldataset@@UAAPBDXZ)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual enum 
CPLErr __cdecl GDALDataset::SetProjection(char const *) 
(?setproject...@gdaldataset@@UAA?AW4CPLErr@@p...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual enum 
CPLErr __cdecl GDALDataset::GetGeoTransform(double *) 
(?getgeotransf...@gdaldataset@@UAA?AW4CPLErr@@p...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual enum 
CPLErr __cdecl GDALDataset::SetGeoTransform(double *) 
(?setgeotransf...@gdaldataset@@UAA?AW4CPLErr@@p...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual enum 
CPLErr __cdecl GDALDataset::AddBand(enum GDALDataType,char * *) 
(?addb...@gdaldataset@@UAA?AW4CPLErr@@W4GDALDataType@@pa...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual void 
* __cdecl GDALDataset::GetInternalHandle(char const *) 
(?getinternalhan...@gdaldataset@@uaapax...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual 
class GDALDriver * __cdecl GDALDataset::GetDriver(void) 
(?getdri...@gdaldataset@@UAAPAVGDALDriver@@XZ)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: virtual char 
* * __cdecl GDALDataset::GetFileList(void) 
(?getfilel...@gdaldataset@@UAAPAPADXZ)
1WinCE_G.obj : error LNK2001: 

[gdal-dev] RE:GDAL, WinCE dll error when using in my own simple project

2010-06-22 Thread Zermeno, Robert J CIV NAVAIR, 472100D
Everyone,

When it comes to compiling WinCE in MSVC80, I get all of those error messages.  
However, when I compile in EVC4.0 IDE, it will compile cleanly, but when I try 
to link the file, I would get the same exact error messages.  

Can someone tell me what files to use.  I have compiled both current SVN trunk 
and GDAL 1.4.0 versions.  For version most current, SVN Trunk, it is missing 
three files related to gtiff library and one ogr core file, ogr_geos_convert.h 
(I believe that is the name).  All I did was added the files from GDAL 1.4.0 to 
the SVN trunk (it will cleanly build with no errors but the ones metioned in 
first email with LNK2001 and LNK2019 errors.

Thanks,
Robert 


-Original Message-
From: gdal-dev-boun...@lists.osgeo.org 
[mailto:gdal-dev-boun...@lists.osgeo.org] On Behalf Of 
gdal-dev-requ...@lists.osgeo.org
Sent: Tuesday, June 22, 2010 9:11
To: gdal-dev@lists.osgeo.org
Subject: gdal-dev Digest, Vol 73, Issue 47

Send gdal-dev mailing list submissions to
gdal-dev@lists.osgeo.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.osgeo.org/mailman/listinfo/gdal-dev
or, via email, send a message with subject or body 'help' to
gdal-dev-requ...@lists.osgeo.org

You can reach the person managing the list at
gdal-dev-ow...@lists.osgeo.org

When replying, please edit your Subject line so it is more specific than Re: 
Contents of gdal-dev digest...


Today's Topics:

   1.   GDAL, WinCE dll error when using in my own simple project
  (Zermeno, Robert J CIV NAVAIR, 472100D)
   2. I am trying to run gdal_polygonize.py and I get the   following
  error: gdal.Polygonize() not available. (John Mitchell)


--

Message: 1
Date: Tue, 22 Jun 2010 09:08:37 -0700
From: Zermeno, Robert J CIV NAVAIR, 472100D
robert.zerm...@navy.mil
Subject: [gdal-dev] GDAL, WinCE dll error when using in my own simple
project
To: gdal-dev@lists.osgeo.org
Message-ID:

f8a8a114e3f41d4d9157f1becca3ba9103389...@nawechlkez02v.nadsuswe.nads.navy.mil

Content-Type: text/plain; charset=us-ascii

I hope someone has remembered the capability issues concerning WinCE and GDAL 
(since its not really being maintained right now).  My issue is I am able to 
use the provided MSVC++ 2005 gdal project files and build the project to obtain 
a gdalce_i.lib and gdalce.dll files.

I created two projects, one in EVC4.0 and MSVC++ 2005 IDE.  Both compilers have 
provided me with the following error when I try to statically link the DLL and 
use:

#include gdal_priv.h

...
GDALAllRegister();

I followed the building and installation guide from: 
http://www.gdal.org/wince.html, and it all works, but I get the following error 
messages when I try to use the DLL:

1-- Build started: Project: WinCE_G, Configuration: Debug Pocket PC 
12003 (ARMV4) -- Compiling...
1cl : Command line warning D9035 : option 'GX' has been deprecated and 
1will be removed in a future release cl : Command line warning D9025 : 
overriding '/GR-' with '/GR'
1stdafx.cpp
1Compiling...
1cl : Command line warning D9035 : option 'GX' has been deprecated and 
1will be removed in a future release cl : Command line warning D9025 : 
overriding '/GR-' with '/GR'
1WinCE_G.cpp
1Linking...
1   Creating library Pocket PC 2003 (ARMV4)\Debug/WinCE_G.lib and 
1object Pocket PC 2003 (ARMV4)\Debug/WinCE_G.exp WinCE_G.obj : error 
1LNK2001: unresolved external symbol public: virtual char const * 
1__cdecl GDALMajorObject::GetDescription(void)const  
1(?getdescript...@gdalmajorobject@@UBAPBDXZ)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: 
1virtual void __cdecl GDALMajorObject::SetDescription(char const *) 
1(?setdescript...@gdalmajorobject@@uaax...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: 
1virtual char * * __cdecl GDALMajorObject::GetMetadata(char const *) 
1(?getmetad...@gdalmajorobject@@uaapapad...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: 
1virtual enum CPLErr __cdecl GDALMajorObject::SetMetadata(char * *,char 
1const *) (?setmetad...@gdalmajorobject@@UAA?AW4CPLErr@@papad...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: 
1virtual char const * __cdecl GDALMajorObject::GetMetadataItem(char 
1const *,char const *) 
1(?getmetadatai...@gdalmajorobject@@uaapbdp...@z)
1WinCE_G.obj : error LNK2001: unresolved external symbol public: 
1virtual enum CPLErr __cdecl GDALMajorObject::SetMetadataItem(char 
1const *,char const *,char const *) 
1(?setmetadatai...@gdalmajorobject@@UAA?AW4CPLErr@@pb...@z)
1WinCE_G.obj : error LNK2019: unresolved external symbol public: 
1virtual __cdecl GDALMajorObject::~GDALMajorObject(void) 
1(??1GDALMajorObject@@u...@xz) referenced in function public: virtual 
1void * __cdecl GDALMajorObject::`scalar deleting destructor'(unsigned 
1int) (??_GGDALMajorObject@@uaap...@z) WinCE_G.obj : error LNK2001

RE: [gdal-dev] Proper parameters for GDALBeginAsyncReader() for RGB images

2010-06-17 Thread Zermeno, Robert J CIV NAVAIR, 472100D
Thanks Frank!

It made a lot of sense.  My last comment concerning this function is how would 
you be able to 
Acquire a smaller image size of a larger image using GDALBeginAsyncReader() for 
RGB images?

I can get it to work for Grayscale, but using the same parameters for RGB gives 
me an AccessViolation
Error.

Example:
Example not exact: 
Assume:
ImageWidth = 800
ImageHeight = 400
BufferXSize = 150
BufferYSize = 150
colorScheme = 3 (For RGB)
Bandmap[0] = 1, Bandmap[1] = 2, Bandmap[2] = 3
BYTE* JPIP_Buffer = (BYTE*)CLPMalloc(BufferXSize * BufferYSize * colorScheme) 


Call to function:

GDALBeginAsyncReader(fileDataset,
0, 0,   //Start at top-left position
ImageWidth, ImageHeight,//Note, I am requesting whole image.
JPIP_Buffer,
BufferXSize,
BufferYSize,
GDT_Byte,
colorScheme,
Bandmap,
0,
0,
0,
0);


Under the hood, how does the function take the original image size and scale it 
down to fit
Into the a size much smaller than original? For some reason, when I do this for 
RGB color 
Images, it gives a AccessViolation error when it calls 
GDALARGetNextUpdatedRegion().  However,
For Grayscale images, it works fine.  What would you think might be the problem?

Thanks,

Robert

-Original Message-
From: fwarmer...@gmail.com [mailto:fwarmer...@gmail.com] On Behalf Of Frank 
Warmerdam
Sent: Wednesday, June 16, 2010 10:05
To: Zermeno, Robert J CIV NAVAIR, 472100D
Cc: gdal-dev@lists.osgeo.org
Subject: Re: [gdal-dev] Proper parameters for GDALBeginAsyncReader() for RGB 
images

On Wed, Jun 16, 2010 at 12:51 PM, Zermeno, Robert J CIV NAVAIR, 472100D 
robert.zerm...@navy.mil wrote:

 Do I call GDALBeginAsyncReader() three times like RasterIO?  One call 
 for Red, one for Blue, and Green?

Robert,

The AsyncReader API allows reading multiple bands in one pass, much like the 
RasterIO call on the GDALDataset.

 Am I correct so far?  For the Length of Buffer where I want to place 
 the bytes, Should I have the parameter as  (xSize * 
 GDALGetRasterCount(fileDataset) )

This is correct,

 On to
 GDALBeginAsyncReader(fileDataset,
        0, 0,                           //Start at top-left position
        BufferXSize, BufferYSize,
        JPIP_Buffer,
        BufferXSize * colorScheme,
        BufferYSize,
        GDT_Byte,
        colorScheme,
        Bandmap,
        0,
        0,
        0,
        0);

I think the problem is your passing of BufferXSize * colorScheme.
That arguments should be the number of pixels in X, but not taking in account 
the number of bands.

 How is the image data stored in JPIP_Buffer. Whould it be:
 1.rgbrgbrgbrgb
 2.
 3.bgrbgrbgrbgr

By default (if all zero for the interleaving options) the image will be 
returned in band sequential form.  So option '2' above.

Best regards,
-- 
---+
---+--
I set the clouds in motion - turn up   | Frank Warmerdam, warmer...@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush| Geospatial Programmer for Rent


smime.p7s
Description: S/MIME cryptographic signature
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] Proper parameters for GDALBeginAsyncReader() for RGB images

2010-06-16 Thread Zermeno, Robert J CIV NAVAIR, 472100D
Hi everyone,

I hope someone can clarify my issue when it comes to an RGB jpeg2000 image call
Using GDALBeginAsyncReader().  I can use this function already for Grayscale 
images, but
Having problems getting RGB colors to work.

In streaming jpeg2000 images (JPIP),How do you properly use 
GDALBeginAsyncReader() parameters in conjunction with 
GDALARGetNextUpdatedRegion().

So far, I usually get a AccessViolation which fails on the 
GDALARGetNextUpdatedRegion() call.  That 
would mean the way I provide the parameter information is not correct.

Do I call GDALBeginAsyncReader() three times like RasterIO?  One call for Red, 
one for Blue, 
and Green?

If I am correct, GDALBeginAsyncReader only needs to be called once.  This 
function asks for
the BandCount (1 for GrayScale, 3 for RGB) and Bandmap (Where 1 is GrayScale, 
and when in
case for RGB, 1 == Red Band 2 == Blue Band 3 == Green Band).

Am I correct so far?  For the Length of Buffer where I want to place the bytes, 
Should I have the
parameter as  (xSize * GDALGetRasterCount(fileDataset) )


On top of this, can someone give me an example call to GDALBeginAsyncReader() 
with parameters
for an RGB image.
Example not exact: 
Assume:
ImageWidth = 800
ImageHeight = 400
BufferXSize = 400
BufferYSize = 400
colorScheme = 3 (For RGB)
Bandmap[0] = 1, Bandmap[1] = 2, Bandmap[2] = 3
BYTE* JPIP_Buffer = (BYTE*)CLPMalloc(BufferXSize * BufferYSize * colorScheme)

Now, would I call the function as:

GDALBeginAsyncReader(fileDataset,
0, 0,   //Start at top-left position
BufferXSize, BufferYSize,   
JPIP_Buffer,
BufferXSize * colorScheme,
BufferYSize,
GDT_Byte,
colorScheme,
Bandmap,
0,
0,
0,
0);

How is the image data stored in JPIP_Buffer. Whould it be:
1.rgbrgbrgbrgb
2.
3.bgrbgrbgrbgr

Thanks in advanced!!


smime.p7s
Description: S/MIME cryptographic signature
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] Reading RGB jpeg2000 image using Kakadu...proper order

2010-05-10 Thread Zermeno, Robert J CIV NAVAIR, 472100D
Frank,

Is there a specific order needed to read in the image pixels?  Meaning, you 
typically need to use the combination functions of:
1. 
Redband  = GDALRasterBand(dataset,1)
Blueband = GDALRasterBand(dataset,2)
Greenband= GDALRasterBand(dataset,3)
2. 
GDALRasterIO(redBand)
GDALRasterIO(Blueand)
GDALRasterIO(GreenBand)

3. Depending on if Band 1 is Red, then store image data as:
Image[0] = BlueBand
Image[1] = GreenBand
Image[2] = RedBand

This is a very general sense.  I have noticed if I switch the order of 
GDALRasterband, I am provided with an image that is not displayed correctly 
(certain colors of off).




smime.p7s
Description: S/MIME cryptographic signature
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] CPLMalloc() and CPLFree() issues....

2010-05-06 Thread Zermeno, Robert J CIV NAVAIR, 472100D
I have been using the standard malloc, but trying to use CPLMalloc() with 
CPLFree().  I have a function that will provide a user with different image 
blocks given specified location.

So, a function will get repeatedly called to grab the new image data content.  
On the first round, I can successfully perform CPLMalloc() and CPLFree().  
However, on the second pass, I get a runtime requested error that terminates my 
program when I do another CPLMalloc(). 

Can anyone think why I might be receiving this error message?

This so far has only happened on RGB images where I have to CPLMalloc() three 
times on the current image.


smime.p7s
Description: S/MIME cryptographic signature
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] Manual JPEG2000 image data error returned by GDALRasterIO

2010-05-05 Thread Zermeno, Robert J CIV NAVAIR, 472100D
GDAL club,

I am using a test image, called world.jp2, you could download from 
http://www.microimages.com/gallery/jp2/, specifically, 
http://www.microimages.com/gallery/jp2/1.jp2.  I have made my own application 
to provide block segments viewing capabilities in both .jp2 and .tif format.

I converted this file, world.jp2 to world.tif, to test my code.  Objective is 
get a block of image data given xoff,yoff,xsize,ysize.  If the parameters go 
outside bounds, I manually readjust the xsize and ysize to what was given to 
what GDAL can actually retrieve using the xoff,yoff as my origin for new image.

This code works for .tif images.  I have tested it thoroughly and have not had 
any problems.  For .jp2 files, Whenever I acquire the bottom region of the 
file, the remaining 10 lines or so of the image, GDALRasterIO() returns bad 
values but it still does not give me an error.  Can someone duplicate this test 
case.  I believe it should be a new ticket, but I need confirmation first.

Detailed example test case that provides bad output: 
JPEG2000 Driver Using: KAKADU
File name: World.jp2
Size: Width = 800 Heigth = 400
pixelOffset = 0
lineOffset  = 100
usrImageWidth = 512
UsrImageHeight = 300

This will grab the bottom left corner of the image.  It correctly gives me the 
image data all the way up to approx. line 285 or 295...

Here is my code to parse through world.jp2 which is a RGB color format:

BYTE* __fastcall GeoJp2k::getImageBlockLocation(int pixelOffset, int lineOffset,
int 
usrImageWidth, int UsrImageHeight)
  int imgLoc = 0;
  int requestedBlockHeight = 0;
if(GDALGetOverviewCount(mainImageBand)  0)
{

curError = CE_None; //Reset b4 reading in data...

curGeoData-setImageColorFormat(GDALGetRasterColorInterpretation(mainImageBand));
GDALColorInterp curColorFormat = curGeoData-getColorFormat();
if(curColorFormat == GCI_GrayIndex)
{
//GrayScale format image...
//removed for this purpose...   
}
else if(curColorFormat == GCI_RedBand)
{
//GCI_RedBand refers to RGB Format image...

 //Image data in Bands
 // GDALGetRasterBand() retrieves...
 //Band 1:  RED
 //Band 2:  GREEN
 //Band 3:  BLUE
GDALRasterBandH RedBand, GreenBand, BlueBand;
CPLErr RedError   = CE_None;
CPLErr GreenError = CE_None;
CPLErr BlueError  = CE_None;

BYTE *RedStrip   = NULL; //
BYTE *GreenStrip = NULL; //
BYTE *BlueStrip  = NULL;

RedStrip   = (BYTE *) malloc(usrImageWidth); //
GreenStrip = (BYTE *) malloc(usrImageWidth); //
BlueStrip  = (BYTE *) malloc(usrImageWidth); //


//Retrieve the RGB colors
RedBand   = GDALGetRasterBand(fileDataset, 1);
GreenBand = GDALGetRasterBand(fileDataset, 2);
BlueBand  = GDALGetRasterBand(fileDataset, 3);

for(int curRow =0; curRow  UsrImageHeight  curError 
== CE_None; curRow++)
{

 
 RedError   =   GDALRasterIO( 
RedBand, GF_Read,
  pixelOffset,
  lineOffset + curRow,
  usrImageWidth,
  1,
  RedStrip,
  usrImageWidth,
  1,
  GDT_Byte,
  0,
  0 );

 GreenError =   GDALRasterIO( 
GreenBand, GF_Read,
  pixelOffset ,
  lineOffset + curRow,
  usrImageWidth,
  1,
  GreenStrip,
  usrImageWidth,
  1,
  GDT_Byte,
   

[gdal-dev] How to extract Well Known Text Coordinate System information (WKT)..., OGR unresolved reference problem

2010-04-22 Thread Zermeno, Robert J CIV NAVAIR, 472100D
Hi everyone,

I am enjoying the simplicity of GDAL with integrating with various formats.  I 
have two related questions.
1.  How can I simply extract individual pieces of WKT?  Meaning, The returned 
string from GetProjectionRef() returns a WKT format coordinate system string 
describing the geographical reference the image pertains to.  I would like to 
grab each of the components.


2. This is kind of a question:
  Instead of parsing through the XML myself, I thought GDAL already has this 
functionality.  I have tried to perform:

OGRSpatialReferenceH poSRS;
poSRS-GetPrimeMeridian(), but I receive an unresolved reference compile error. 
 This is odd to me.  I can do the GDAL API tutorial section that uses 
OSRSetUTM(), OSRDestroySpatialReference(), OSRExportToWKt().  
I have tried to include all main ogr.h files: ogr_api.h, ogr_spatialref.h, 
ogr_core.h, ... But no such luck. 


The platform I am using is Borland C++.  I compiled a dll and lib file through 
MSVC 2008 and used Borland coff2omf.exe to properly convert the lib file.

3.  Another question popped into mind:
When compiling, should I change option in GDALRoot/nmake.opt to comment out 
DLLBUILD.  I have INCLUDE_OGR_FRMTS set to YES.  What would you think I'm 
missing.


smime.p7s
Description: S/MIME cryptographic signature
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] RE: Extract WKT actual Data Values starting with rootNode

2010-04-22 Thread Zermeno, Robert J CIV NAVAIR, 472100D
Frank,

Thanks a lot for the tips.  I have been playing around a bit with the C API and 
documentation and noticed that the way gdal is loaded in Borland, I cannot use 
the C++ api of gdal.

My objective is I want to acquire the root node of the WKT tree and for each 
node, extract the value and its associated data.

Example:
  curRoot = SPHEROID
  value = WSG 84
  Data  = integer1, integer2 

How can I do this using the C API?  I think that is why you mentioned C++ API 
has more functionality, like GetRoot().

I cannot build a OGR_SRSNode tree using importFromWKT() or use its Constructor. 
 Reason it's a C++ API and for some reason in Builder, it gives me an 
unresolved reference.  So, I know something is wrong with my .lib file.

Last resort is I could use the ExportToPrettyWKT() and manually parse through 
it (which is WAY easier than then ExportToWKT() )

Thanks for your help,
Robert

-Original Message-
From: Frank Warmerdam [mailto:warmer...@pobox.com] 
Sent: Thursday, April 22, 2010 9:29
To: Zermeno, Robert J CIV NAVAIR, 472100D
Cc: gdal-dev@lists.osgeo.org
Subject: Re: [gdal-dev] How to extract Well Known Text Coordinate System 
information (WKT)..., OGR unresolved reference problem

Zermeno, Robert J CIV NAVAIR, 472100D wrote:
 Hi everyone,
 
 I am enjoying the simplicity of GDAL with integrating with various formats.
 I have two related questions. 1.  How can I simply extract individual 
 pieces of WKT?  Meaning, The returned string from GetProjectionRef() 
 returns a WKT format coordinate system string describing the 
 geographical reference the image pertains to.  I would like to grab each of 
 the components.

Robert,

The GetAttrValue() method on OGRSpatialReference can generally be used to 
extract specific data items from a coordinate system definition.
For instance:

   const char *pszDatumName = poSRS-GetAttrValue(DATUM);

would search the WKT for the DATUM node, and extract the associated text.

 2. This is kind of a question: Instead of parsing through the XML 
 myself, I thought GDAL already has this functionality.  I have tried to 
 perform:
 
 OGRSpatialReferenceH poSRS; poSRS-GetPrimeMeridian(), but I receive 
 an unresolved reference compile error.  This is odd to me.  I can do 
 the GDAL API tutorial section that uses OSRSetUTM(), 
 OSRDestroySpatialReference(), OSRExportToWKt(). I have tried to 
 include all main ogr.h files: ogr_api.h, ogr_spatialref.h, ogr_core.h, ... 
 But no such luck.
 
 
 The platform I am using is Borland C++.  I compiled a dll and lib file 
 through MSVC 2008 and used Borland coff2omf.exe to properly convert 
 the lib file.

My conclusion would be that this is something peculiar about the way you are 
building or Borland C++.  It may help to stick to the C rather than C++ API 
though there are some methods not exposed through C.

Good luck,
-- 
---+
---+--
I set the clouds in motion - turn up   | Frank Warmerdam, warmer...@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush| Geospatial Programmer for Rent



smime.p7s
Description: S/MIME cryptographic signature
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] GDAL and JPEG2000 (Kakadu specially), manually reading image data

2010-04-06 Thread Zermeno, Robert J CIV NAVAIR, 472100D
Can anyone let me know how to properly read a 24bpp JPEG2000 image data?  This 
image has 1 Band overview.  I am using the C API.

I have a few questions.  Please respond even if you know something about any of 
the questions I have.

1.  Can someone reference me to where I can acquire what Band overviews are in 
respect to JPEG2000?

2. What does GDALGetOverview() really return when referring to image data?  I 
understand it returns a GDALRasterBandH in which I can call GDALReadBlock(), 
but it does not successfully (I believe its because my image array is not big 
enough).

3. In GDALReadBlock(), what does it mean when this method returns a natural 
block from the raster band?  So, since my image is say 24bpp 900 x 900, will 
return a line of 900 x 3 (for RGB per pixel)?

4.  When using GDALReadBlock() when the image has an overview, I still retrieve 
image data before even calling GDALGetOverview().  What data am I actually 
getting?

My main issue is understanding how the image data in JPEG2000 is retrieved by 
GDAL and what GDALGetOverview() and GDALReadBlock() really returns to the 
programmer when your image contains an Overview? 

Robert


smime.p7s
Description: S/MIME cryptographic signature
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] GDAL, Borland C++, and GeoPDF

2010-03-09 Thread Zermeno, Robert J CIV NAVAIR, 472100D
Has anyone attempted to port GDAL to Borland (codegear) c++?  If so or not, can 
you give input as to what might need to be done to get the code working in 
Borland (issues of portability? Files I might need to touch?).  My supervisors 
have funded me money to take GDAL to be ported to Borland.  I have seen the 
link that specifies main issues:  
http://trac.osgeo.org/gdal/wiki/FAQInstallationAndBuilding#CanIbuildGDALwithBorlandCorotherCcompilers,
 under the question: Can I build GDAL with Borland C or other C compilers?.

Responses will be much appreciated.  Once I have completed it, I will like to 
supply my solution to the group.  

Lastly, what has become of GeoPDF and GDAL?  I read talks of people wanting 
this option, but what is the current status?  Is someone doing it or until a 
later time?

Robert


smime.p7s
Description: S/MIME cryptographic signature
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev