Hexagon Geospatial
MENU

ERDAS APOLLO & ECW/JP2

Wondering how others have configured their ERDAS APOLLO server or what data they are crawling? The ERDAS APOLLO Discussion board is a place to find information, share ideas and more. Join the community, connect, contribute and share.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
New Contributor
Posts: 3
Registered: ‎06-26-2019
Accepted Solution

16Bit Grayscale Tiff to ECW v3 16bit conversion

Hi Everyone,

 

I want to compress a tiff image as ecw uint16 bit. I used your ECWSDK5.3 library to compress and libtiff to read tiff image. When I set nBits of the band is 8, conversion is done successfully, on the other hand, if i set nBits is 16, it gets "Parameter not matched for corresponding compression version" although I have set the nFormatVersion is 3. Is there any other option or parameter being set for the successful conversion? Which parameter or method do i have to use to get a ecw 16bit compressed image? I added the code block that I get the error below.

 

Thanks.

Ali

 

if ((pClient = NCSCompressAllocClientA())) {
  NCSError eError;
  
  strncpy(pClient->uOutputFileName.szOutputFileName, argv[2], MAX_PATH);
  pClient->fTargetCompression = (float)10.0;
  pClient->nFormatVersion=3;
  printf("%d %d\n",imagelength,imagewidth);
  pClient->nInOutSizeX = imagewidth;
  pClient->nInOutSizeY = imagelength;
  pClient->nInputBands = 1;
  pClient->nOutputBands = 1;
  NCSInitFileBandInfo(&pClient->pBands, pClient->nInputBands);
  pClient->pBands[b].nBits = 16;     // This is the line we get error, as far as I understood.
 
  pClient->pReadCallback = ReadCallback;
  pClient->pStatusCallback = StatusCallback;
  pClient->pCancelCallback = CancelCallback;
  eError = NCSCompressOpen(pClient, FALSE);
  if (eError != NCS_SUCCESS) {
   ReportError("NCSCompressOpen failed: %s", NCSGetErrorText(eError));
  }
  else {
   // Opened OK, now do the compression
   eError = NCSCompress(pClient);
   if (eError == NCS_COULDNT_READ_INPUT_LINE) {
    ReportError("Compression error: %s (%s)",
     NCSGetErrorText(eError), CompressReadInfo.pErrorBuffer);
   }
   else if (eError != NCS_SUCCESS) {
    ReportError("Compression error: %s", NCSGetErrorText(eError));
   }
   else {  // Compressed ok
    // Close the compression
    eError = NCSCompressClose(pClient);
    if (eError != NCS_SUCCESS) {
     ReportError("NCSCompressClose failed: %s",
      NCSGetErrorText(eError));
    }
New Contributor
Posts: 3
Registered: ‎06-26-2019

Re: 16Bit Grayscale Tiff to ECW v3 16bit conversion

I found the problem. I need to set nCellBitDepth parameter to 16 for the compress client, before setting band depth. 

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.