私は医用画像を処理するためにITKとプロジェクトを行っています。多くの作業の後、それ以上のコンパイルエラーはありませんが、リンクプロセスで次の情報があります。
1> ------生成が開始されました:プロジェクト:prueba_r01、構成:デバッグ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:extern symbol "public: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 resolver
1> prueba_r01-2つのエラー、0つの警告==========一般:0の修正、1の誤り、0の実現、0の省略==========
メソッドmultiply_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はdouble[2]であり、最初の行は実数部、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;
}
どんな助けでも本当にいいでしょう!今はかなり迷っています…ありがとう!グラシアス!アントニオ