mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 11:40:44 +08:00
provide better error messages
This commit is contained in:
parent
c48e237dd0
commit
dce310e03c
@ -3157,10 +3157,12 @@ same object.
|
||||
|
||||
@param signature1 First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix.
|
||||
Each row stores the point weight followed by the point coordinates. The matrix is allowed to have
|
||||
a single column (weights only) if the user-defined cost matrix is used.
|
||||
a single column (weights only) if the user-defined cost matrix is used. The weights must be
|
||||
non-negative and have at least one non-zero value.
|
||||
@param signature2 Second signature of the same format as signature1 , though the number of rows
|
||||
may be different. The total weights may be different. In this case an extra "dummy" point is added
|
||||
to either signature1 or signature2 .
|
||||
to either signature1 or signature2. The weights must be non-negative and have at least one non-zero
|
||||
value.
|
||||
@param distType Used metric. See cv::DistanceTypes.
|
||||
@param cost User-defined \f$\texttt{size1}\times \texttt{size2}\f$ cost matrix. Also, if a cost matrix
|
||||
is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
|
||||
|
@ -387,7 +387,7 @@ static int icvInitEMD( const float* signature1, int size1,
|
||||
|
||||
}
|
||||
else if( weight < 0 )
|
||||
CV_Error(CV_StsOutOfRange, "");
|
||||
CV_Error(CV_StsBadArg, "signature1 must not contain negative weights");
|
||||
}
|
||||
|
||||
for( i = 0; i < size2; i++ )
|
||||
@ -401,11 +401,13 @@ static int icvInitEMD( const float* signature1, int size1,
|
||||
state->idx2[dsize++] = i;
|
||||
}
|
||||
else if( weight < 0 )
|
||||
CV_Error(CV_StsOutOfRange, "");
|
||||
CV_Error(CV_StsBadArg, "signature2 must not contain negative weights");
|
||||
}
|
||||
|
||||
if( ssize == 0 || dsize == 0 )
|
||||
CV_Error(CV_StsOutOfRange, "");
|
||||
if( ssize == 0 )
|
||||
CV_Error(CV_StsBadArg, "signature1 must contain at least one non-zero value");
|
||||
if( dsize == 0 )
|
||||
CV_Error(CV_StsBadArg, "signature2 must contain at least one non-zero value");
|
||||
|
||||
/* if supply different than the demand, add a zero-cost dummy cluster */
|
||||
diff = s_sum - d_sum;
|
||||
|
Loading…
Reference in New Issue
Block a user