1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Prevent crash when attempting to create training data without responses.

This is at least useful when using an SVM one-class linear classifier, so there are valid use cases.
This commit is contained in:
Rink Springer
2017-06-30 15:32:40 +02:00
committed by Rink Springer
parent a84a5e8f1a
commit 3ce1bca670
+1 -1
View File
@@ -403,7 +403,7 @@ public:
Mat(tempCatMap).copyTo(catMap);
}
if( varType.at<uchar>(ninputvars) == VAR_CATEGORICAL )
if( noutputvars > 0 && varType.at<uchar>(ninputvars) == VAR_CATEGORICAL )
{
preprocessCategorical(responses, &normCatResponses, labels, &counters, sortbuf);
Mat(labels).copyTo(classLabels);