![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
#1
|
|||
|
|||
|
Добрый день!
Есть библиотека написанная в visual studio 2008 с++ и нужно её подключить на дэлфи. Начал я делать следующее: Код:
unit increase_h; interface const dll = 'dll.dll'; procedure Get_image_size(input_frame: char; width: integer; height: integer); stdcall; procedure Read_image(fname: char; pdat: Byte); stdcall; procedure Cal_psnr(pOrig: Byte; pImg: Byte; width: integer; height: integer); stdcall; function Write2PGM(pImg: Byte; width: integer; height: integer; fname: char): pImg; stdcall; implementation procedure Get_image_size; external dll; procedure Read_image; external dll; procedure Cal_psnr; external dll; function Write2PGM; external dll; procedure read_header; external dll; procedure Downsampling; external dll procedure Bicubic; external dll; procedure NL_filtering; external dll; procedure Fast_Motion_estimation; external dll; procedure Data_fusion; external dll; procedure Cal_SAD_New; external dll; procedure NL_Backprojection; external dll; procedure Add_error; external dll; procedure Norm2; external dll; procedure Diff_Norm2; external dll; procedure Float2uchar; external dll; procedure Blurring; external dll; procedure Error_image; external dll; procedure Bicubic_float; external dll; procedure Data_fusion_float; external dll; end. У меня возникли ошибки, похоже неправильно определил входные и выходные параметры, помогите пожалуйста разобраться :3 А вот основной кусок кода из dll библиотеки: Код:
int main(int argc, char* argv[])
{
int i, j, width, height, maxval, comp, lwidth, lheight, row, col, scale;
unsigned char *hr_im, *ori_im, *lr_im;
unsigned char temp;
double psnr1;
FILE *fp;
int *g_mvx[ N ], *g_mvy[ N ];
float *g_mse[ N ];
if( argc<3 )
{
printf("Usage: NL_Backprojection LR_image(pgm) HR_image(pgm) [Original_image(pgm)] \n");
return 1;
}
scale = 2;
if ( Get_image_size( argv[1], &lwidth, &lheight ) )
{
printf( "Can not read %s", argv );
return 1;
}
width = lwidth*scale;
height = lheight*scale;
hr_im = (unsigned char*) malloc( sizeof(char)*width*height );
ori_im = (unsigned char*) malloc( sizeof(char)*width*height );
lr_im = (unsigned char*) malloc( sizeof(char)*lwidth*lheight );
Read_image( argv[1], lr_im );
printf( "Start to processing %s\n", argv[1] );
Bicubic( lr_im, hr_im, scale, lwidth, lheight );
Write2PGM( hr_im, width, height, "Bic_image.pgm" );
if ( argc >3 )
{
Read_image( argv[3], ori_im );
printf( "Bicubic, PSNR = %f\n", Cal_psnr( ori_im, hr_im, width, height ) );
}
for ( i = 0; i < N; i ++ )
{
g_mvx[ i ] = (int*) malloc( sizeof(int)*width*height );
g_mvy[ i ] = (int*) malloc( sizeof(int)*width*height );
g_mse[ i ] = (float*) malloc( sizeof(int)*width*height );
}
NL_filtering( hr_im, width, height, g_mvx, g_mvy, g_mse );
NL_Backprojection( hr_im, width, height, ori_im, g_mvx, g_mvy, g_mse, argc );
if ( argc > 3 )
{
printf( "After Backprojection, PSNR = %f\n", Cal_psnr( ori_im, hr_im, width, height ) );
}
printf("\nWrite to file: %s.\n",argv[2]);
Write2PGM( hr_im, width, height, argv[2] );
free( hr_im );
free( ori_im );
free( lr_im );
for ( i = 0; i < N; i ++ )
{
free( g_mvx[ i ] );
free( g_mvy[ i ] );
free( g_mse[ i ] );
}
return 0;
}
Заранее благодарен) |