Fixed crash (OpenCV Error: Unsupported format or combination of formats) when both detector and descriptors are changed AND new type is not compatible with nearest-beighbor approach used (float vs binary)

This commit is contained in:
matlabbe 2016-01-17 15:21:03 -05:00
parent 706f83ffd4
commit 2c0e121d82

View File

@ -558,6 +558,7 @@ void ParametersToolBox::changeParameter(const int & value)
QCheckBox * checkBox = qobject_cast<QCheckBox*>(sender()); QCheckBox * checkBox = qobject_cast<QCheckBox*>(sender());
if(comboBox) if(comboBox)
{ {
bool descriptorChanged = false;
if(comboBox->objectName().compare(Settings::kFeature2D_1Detector()) == 0) if(comboBox->objectName().compare(Settings::kFeature2D_1Detector()) == 0)
{ {
QComboBox * descriptorBox = (QComboBox*)this->getParameterWidget(Settings::kFeature2D_2Descriptor()); QComboBox * descriptorBox = (QComboBox*)this->getParameterWidget(Settings::kFeature2D_2Descriptor());
@ -584,6 +585,7 @@ void ParametersToolBox::changeParameter(const int & value)
this->updateParameter(Settings::kFeature2D_2Descriptor()); this->updateParameter(Settings::kFeature2D_2Descriptor());
descriptorBox->blockSignals(false); descriptorBox->blockSignals(false);
paramChanged.append(Settings::kFeature2D_2Descriptor()); paramChanged.append(Settings::kFeature2D_2Descriptor());
descriptorChanged = true;
} }
else else
{ {
@ -596,7 +598,8 @@ void ParametersToolBox::changeParameter(const int & value)
bool nnStrategyChanged = false; bool nnStrategyChanged = false;
//verify binary issue with nearest neighbor strategy //verify binary issue with nearest neighbor strategy
if(comboBox->objectName().compare(Settings::kFeature2D_2Descriptor()) == 0 || if(comboBox->objectName().compare(Settings::kFeature2D_2Descriptor()) == 0 ||
comboBox->objectName().compare(Settings::kNearestNeighbor_1Strategy()) == 0) comboBox->objectName().compare(Settings::kNearestNeighbor_1Strategy()) == 0 ||
descriptorChanged)
{ {
QComboBox * descriptorBox = (QComboBox*)this->getParameterWidget(Settings::kFeature2D_2Descriptor()); QComboBox * descriptorBox = (QComboBox*)this->getParameterWidget(Settings::kFeature2D_2Descriptor());
QComboBox * nnBox = (QComboBox*)this->getParameterWidget(Settings::kNearestNeighbor_1Strategy()); QComboBox * nnBox = (QComboBox*)this->getParameterWidget(Settings::kNearestNeighbor_1Strategy());