projects
/
platform
/
upstream
/
opencv.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0faa75d
)
avoid crash in cvCalcEMD() when one of the histograms has only one non-zero element...
author
Vadim Pisarevsky
<no@email>
Thu, 29 Jul 2010 11:00:52 +0000
(11:00 +0000)
committer
Vadim Pisarevsky
<no@email>
Thu, 29 Jul 2010 11:00:52 +0000
(11:00 +0000)
modules/imgproc/src/emd.cpp
patch
|
blob
|
history
diff --git
a/modules/imgproc/src/emd.cpp
b/modules/imgproc/src/emd.cpp
index f81467c44da3e571243411eac9d6c17cf3c4db57..e6be13ed85dcc39887ffd62d46e9938964fb2a93 100644
(file)
--- a/
modules/imgproc/src/emd.cpp
+++ b/
modules/imgproc/src/emd.cpp
@@
-297,10
+297,14
@@
CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1,
float val = xp->val;
int i = xp->i;
int j = xp->j;
+
+ if( xp == state.enter_x )
+ continue;
+
int ci = state.idx1[i];
int cj = state.idx2[j];
- if(
xp != state.enter_x &&
ci >= 0 && cj >= 0 )
+ if( ci >= 0 && cj >= 0 )
{
total_cost += (double)val * state.cost[i][j];
if( flow )