Загрузить файл ecw с помощью EWS SDK Linux в Mac OS X -> символ ссылки об ошибке

0

Поэтому я хочу загрузить файл ecw. Я нахожусь на Mac OSX 10.9.1.

Я пытаюсь сделать это, используя этот метод:

//*****************************************************************
//* Lecture d'un fichier ECW dont le nom est passÈ en paramËtre.
//*****************************************************************
int charge_ecw( char *nom_fichier )
 {
 NCSFileView *pNCSFileView;
 NCSFileViewFileInfo    *pNCSFileInfo;

 NCSError eError = NCS_SUCCESS;
 UINT8  **p_p_output_line = NULL;
 UINT8  *p_output_buffer = NULL;
 UINT32 x_size, y_size, number_x, number_y;
 UINT32 start_x, start_y, end_x, end_y;
 UINT32 line;
 UINT32 band;
 UINT32 nBands;
 UINT32 *band_list = NULL;  // list of individual bands to read, may be subset of actual bands

 // Open the input NCSFileView
 eError = NCScbmOpenFileView(nom_fichier, &pNCSFileView, NULL);

 if (eError != NCS_SUCCESS) {
 printf("Could not open view for file:%s\n",nom_fichier);
 printf("Error = %s\n", NCSGetErrorText(eError));
 return(1);
 }
 NCScbmGetViewFileInfo(pNCSFileView, &pNCSFileInfo);
 x_size = pNCSFileInfo->nSizeX;         // Largeur en pixels de l'image ECW
 y_size = pNCSFileInfo->nSizeY;         // Hauteur en pixels de l'image ECW
 nBands = pNCSFileInfo->nBands;         // Nombre de canaux par pixel de l'image ECW (7 pour une image Landsat)
 printf("Input file is [%ld x %ld by %d bands]\n", (long)x_size, (long)y_size, nBands);

 // Have to set up the band list. Compatible with ER Mapper method.
 // In this example we always request all bands.
 band_list = (UINT32 *) malloc(sizeof(UINT32) * nBands);
 if( !band_list ) {
 printf("Error - unable to malloc band list\n");
 NCScbmCloseFileView(pNCSFileView);
 return(1);
 }
 for( band = 0; band < nBands; band++ )
 band_list[band] = band;

 // On donne les coordonnÈes du coin supÈrieur gauche (start_x,start_y)
 // et du coin infÈrieur droit (end_x,end_y) de la zone qu'on souhaite
 // lire dans l'image source ECW.
 start_x = 0;
 start_y = 0;
 end_x = 799;
 end_y = 599;

 // On donne la largeur (number_x) et la hauteur (number_y) qu'on souhaite
 // pour l'image de destination. Dans cet exemple, le bloc de pixels lu dans
 // l'image source sera donc redimensionnÈ, car il sera rÈduit de 800x600
 // pixels ‡ 400x300 pixels.
 number_x = 400;
 number_y = 300;

 printf("Region : [%d,%d] to [%d,%d] for [%d,%d]\n", start_x, start_y, end_x, end_y, number_x, number_y);

 eError = NCScbmSetFileView(pNCSFileView,
 nBands, band_list,
 start_x, start_y, end_x, end_y,
 number_x, number_y);
 if( eError != NCS_SUCCESS) {
 printf("Error = %s\n", NCSGetErrorText(eError));
 NCScbmCloseFileView(pNCSFileView);
 free(band_list);
 return(1);
 }

 p_output_buffer = (UINT8 *) malloc( sizeof(UINT8) * number_x * nBands);
 p_p_output_line = (UINT8 **) malloc( sizeof(UINT8 *) * nBands);

 if( !p_p_output_line || !p_output_buffer) {
 printf("Malloc error for output buffers\n");
 NCScbmCloseFileView(pNCSFileView);
 free(band_list);
 if( p_p_output_line )
 free((char *) p_p_output_line);
 if( p_output_buffer )
 free((char *) p_output_buffer);
 return(1);
 }

 for(band = 0; band < nBands; band++ )
 p_p_output_line[band] = p_output_buffer + (band * number_x);

 // Read each line of the compressed file
 for( line = 0; line < number_y; line++ ) {
 NCSEcwReadStatus eReadStatus;
 eReadStatus = NCScbmReadViewLineBIL( pNCSFileView, p_p_output_line);
 if (eReadStatus != NCSECW_READ_OK) {
 printf("Read line error at line %d\n",line);
 printf("Status code = %d\n", eReadStatus);
 NCScbmCloseFileView(pNCSFileView);
 free(band_list);
 free((char *) p_p_output_line);
 free((char *) p_output_buffer);
 return(1);
 }

 // ---------------------------------------------------------------------------------------
 // Dans le tableau unidimensionnel p_output_buffer on a les valeurs des pixels d'une ligne
 // dÈcompressÈe de l'image.
 // Dans ce tableau 1D, les unes ‡ la suite des autres, on a tout d'abord les valeurs du
 // 1er canal pour tous les pixels, puis les valeurs du 2Ëme canal pour tous les pixels,
 // puis les valeurs du 3Ëme canal pour tous les pixels, et ainsi de suite.
 // On peut donc ici utiliser les valeurs contenues dans p_output_buffer pour remplir les
 // pixels de la classe Image_ms.
 // ...
 // ...
 // ---------------------------------------------------------------------------------------

 }
 free((char *) p_p_output_line);
 free((char *) p_output_buffer);


 // Make the second argument below TRUE if this is the last view of the file and you
 // want the file closed, otherwise it will be kept open in the cache. This can
 // sometimes be an problem when writing plugins.
 NCScbmCloseFileViewEx(pNCSFileView, FALSE);
 free(band_list);

 return(0);
 }

Я включаю:

#include "path/Downloads/libecwj2-3.3/Source/include/NCSECWClient.h"
#include "path/Downloads/libecwj2-3.3/Source/include/NCSErrors.h"

Но у меня есть некоторые ошибки:

error: call to member function 'Add' is ambiguous
                            bRet = a.Add(0,1);

Итак, есть ли решение? Я думал о забытых вариантах? Или просто невозможно использовать?

PS: Я еще не компилировал. Я делаю:

./configure
make ( here the errors )
  • 0
    Правильно ли вы собрали и установили libecwj2-3.3 перед его использованием? Кажется, вы только что загрузили исходники ...
  • 0
    Здравствуйте, когда я использую файл make, кажется, что есть бесконечные ошибки, такие как typedef redefinition или error: out-of-line definition of 'Copy' does not match any declaration in 'CNCSJPCBuffer' , то есть 4 ошибки, когда я пытаюсь их разрешить, возникает x других ошибок и т. д.
Показать ещё 4 комментария
Теги:
file
macos

1 ответ

0

Вам не хватает некоторых флагов компоновщика. Возможно, что-то вроде -lecwj2, я не уверен, но это будет "-l" плюс имя файла.a, установленного ECWJ, минус префикс "lib". Поместите это как аргументы в GCC/Clang в командной строке (если вы используете Xcode, это будет где-то зарыто в диалоговом окне).

  • 0
    Спасибо вам. Теперь я пытаюсь отладить какую-то ошибку в библиотеке, потому что она еще не скомпилирована

Ещё вопросы

Сообщество Overcoder
Наверх
Меню