Я выполняю проект с ITK для обработки медицинских изображений. После большой работы больше нет ошибок компиляции, но в процессе компоновки у меня есть следующая информация:
1›------ Начато создание: проект: prueba_r01, конфигурация: Debug Win32 ------ 1›Связывание… 1›Создание библиотеки C:\Documents and Settings\GTTS\Mis documentos\Visual Studio 2008\Projects \prueba_r01\Debug\prueba_r01.lib и объект C:\Documents and Settings\GTTS\Mis documentos\Visual Studio 2008\Projects\prueba_r01\Debug\prueba_r01.exp
1›prueba_r01.obj : ошибка LNK2019: общедоступный внешний символ: double (* __thiscall prueba_r01::multiply_matrix_2D(double ()[2],double ()[2],int,int))[2 ] (?multiply_matrix_2D@prueba_r01@@QAEPAY01NPAY01N0HH@Z) неразрешенный, на который есть ссылка в функции private: void __thiscall prueba_r01::filtro(void) (?filtro@prueba_r01@@AAEXXZ)
1>C:\Documents and Settings\GTTS\Mis documentos\Visual Studio 2008\Projects\prueba_r01\Debug\prueba_r01.exe: фатальная ошибка LNK1120: 1 преобразователь externos sin
1›prueba_r01 - 2 ошибки, 0 предупреждений ========== Общее: 0 исправлений, 1 неверных, 0 актуализировано, 0 опущено ==========
Метод multiple_matrix_2D выдает ошибку при вызове внутри приватного слота «filtro()» (переводится как фильтр). Заголовок файла:
#include <QtGui/QMainWindow>
#include "ui_prueba_r01.h"
#include "vicdef.h"
#include "itkImage.h"
#include "math.h"
#include <complex>
#include "fftw3.h"
using namespace std;
#define PI 3.14159265
class prueba_r01 : public QMainWindow
{
Q_OBJECT
public:
typedef double PixelType;
typedef itk::Image < PixelType, 2> ImageType;
ImageType::Pointer imagen;
double** H;
prueba_r01(QWidget *parent = 0, Qt::WFlags flags = 0);
~prueba_r01();
void matrix2D_H(int ancho, int alto, double eta, double sigma);
fftw_complex* multiply_matrix_2D(fftw_complex* out, fftw_complex* H,int a, int b);
private slots:
void openRGB();
void filtro();
private:
Ui::prueba_r01Class ui;
};
#endif // PRUEBA_R01_H
А основная часть, где находится проблема, находится в файле .cpp и отображается здесь:
fftw_complex* res ;
res = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*a*b);
fftw_complex* H_casted= reinterpret_cast<fftw_complex*> (&H);
res = multiply_matrix_2D(out,H_casted, a, b);
Процесс приведения **двойного указателя к *fftw_complex выполняется здесь, потому что я хочу умножить фильтр в частотной области (H(w)) на результат преобразования fft изображения, вот причина. Важно отметить, что fftw_complex является двойным[2], первая строка для действительной части, а вторая для мнимой. И проблемный метод показан ниже:
fftw_complex* multiply_matrix_2D(fftw_complex* out, fftw_complex* H, int a ,int b){
/* The matrix out[axb] or [n0x(n1/2)+1] is the image after the FFT , and the out_H[axb] is the filter in the frequency domain,
both are multiplied POINT TO POINT, it has to be called twice, one for the imaginary part and another for the normal part
*/
fftw_complex *res;
res = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*a*b);
for (int i0 = 0; i0<a ; i0++){
for (int i1 = 0; i1<b ; i1++){
res[i1+a*i0][0] = out[i1+a*i0][0]*(H[0][0]+H[0][1]); // real part
res[i1+a*i0][1] = out[i1+a*i0][1]*(H[0][0]+H[0][1]); // imaginary part
}
}
return res;
}
Любая помощь будет очень приятно! Я совсем потерялся… Спасибо! Грациас! Антонио