Image processing 犰狳库:pinv()使可执行文件崩溃
我试图使用犰狳在相当大的矩阵(1500*1125)(表示图像,如在Matlab中)上进行线性代数计算。我已经编写了一段代码来使用Armadillo计算伪逆,但可执行文件在启动时立即崩溃。我正在使用Armadillo 3.920.2和VisualStudio2010 代码如下:Image processing 犰狳库:pinv()使可执行文件崩溃,image-processing,lapack,blas,armadillo,Image Processing,Lapack,Blas,Armadillo,我试图使用犰狳在相当大的矩阵(1500*1125)(表示图像,如在Matlab中)上进行线性代数计算。我已经编写了一段代码来使用Armadillo计算伪逆,但可执行文件在启动时立即崩溃。我正在使用Armadillo 3.920.2和VisualStudio2010 代码如下: // ....declarations of variables, matrices etc. // Matrix temp contains the image. // rows and cols are the x
// ....declarations of variables, matrices etc.
// Matrix temp contains the image.
// rows and cols are the x and y size of the image matrix,
// whose gradient matrices are L_x and L_y. lambda and beta are constants.
L_x=temp.rows(1,rows-1)-temp.rows(2,rows);
L_y=temp.cols(1,cols-1)-temp.cols(2,cols);
L_x=arma::sqrt(arma::pow(L_x,2)+beta*beta);
L_y=arma::sqrt(arma::pow(L_y,2)+beta*beta);
L=-(L_x+L_y);
Alpha=lambda*L;
unsigned int alpha_size_0=Alpha.n_rows;
unsigned int alpha_size_1=Alpha.n_cols;
arma::Mat<unsigned int> I(alpha_size_0,alpha_size_1);
I.eye();
PI=arma::pinv((I+Alpha));
//.....
变量、矩阵等的声明。
//矩阵温度包含图像。
//行和列是图像矩阵的x和y大小,
//其梯度矩阵为L_x和L_y。lambda和beta是常数。
L_x=临时行(1,行-1)-临时行(2,行);
L_y=温度列(1,列-1)-温度列(2,列);
L_x=arma::sqrt(arma::pow(L_x,2)+β*beta);
L_y=arma::sqrt(arma::pow(L_y,2)+β*beta);
L=-(lux+luy);
α=λ*L;
无符号整数alpha_size_0=alpha.n_行;
无符号整数alpha_size_1=alpha.n_cols;
arma::Mat I(alpha_size_0,alpha_size_1);
I.眼睛();
PI=arma::pinv((I+Alpha));
//.....
是pinv()使应用程序崩溃,因为当我评论最后一行时,就没有问题了。我已经添加了Armadillo库,取消了config.h中use_lapack和use_blas行的注释,在项目中包含了路径,并将.lib文件复制到构建可执行文件的文件夹中。可执行文件甚至不会启动,也不会执行这段代码之前的计算。犰狳3.920已经很老了。升级至4.550系列和更新版本的MSVC。因为你要在大型矩阵上进行计算,所以你也应该使用64位操作系统(出于速度和内存方面的原因)。我记得有一次Armadillo发生过这种情况。我通过使用不同版本的Blas&Lapack(来自不同的网站)解决了这个问题。我建议您从其他地方获取它们。@m我之所以使用3.920,是因为我无法使用Visual Studio 2010生成最新版本。因为我已经有了一个使用VS2010构建的应用程序框架,所以使用3.920比将整个解决方案更新到VS2012或13更容易。此外,我有一个64位操作系统,但应用程序是在Win32配置中构建的。4.550版本对我这样的问题有解决办法吗?@memo1288的不同版本,你是指犰狳,还是你分别使用了Blas和Lapack?@SuryaRajan我是指Blas和Lapack,这是我分别获得的。