Bug in Virtual Dimensionality
Description
I am trying to use the EndmemberNumberEstimation
application with the Virtual Dimensionality (vd
option) algorithm, but it crashes in the call to Compute()
of the VirtualDimensionality
object.
Steps to reproduce
I am using the cuprite hyperspectral dataset (available here).
This application first computes stats (covariance and correlation matrices) on the input image, using a StreamingStatisticsVectorImageFilter
, and then use a VirtualDimensionality
object to compute the number of endmembers.
VirtualDimensionality
computes the eigenvalues of the covariance matrices. In my case I have a few negative eigenvalue, and this is what causes the crash, as we then need to compute :
std::sqrt( 2.0 / m_NumberOfPixels * (eigenCovariance[i] + eigenCorrelation[i] + eigenCovariance[i] * eigenCorrelation[i]) );
And std::sqrt
of a negative number returns nan
, causing an excpetion at the next line. As covariance and correlation matrices are definite positive (right ?), all eigenvalues of these matrices should be positive, no matter what the input is ... Maybe the problem comes from the StreamingStatisticsVectorImageFilter
.
Configuration information
Ubuntu 16.04, develop branch of 11/02/2019