Ask Your Question
1

Potential bug in Shape Context

asked 2015-07-25 12:13:58 -0500

uadhikari gravatar image

File: https://github.com/Itseez/opencv/blob...

Line: 235

In function computeDistance(InputArray contour1, InputArray contour2) the following line seems to be a potential bug. The computation of shape context descriptor of the first shape is fine since it uses its own mean distance for distance noramlisation. However, the second shape is using he mean distance of first shape. The two shapes can be different in the scales so they should use their own mean distance to normalise themselves.

set2SCE.extractSCD(set2, set2SCD, inliers2, set1SCE.getMeanDistance());
edit retag flag offensive close merge delete

Comments

I have to review the paper again, and see if I remember why I did it like this. But in any case, the shape distance should be somewhat invariant to scale transformations, since the affine correction within the TPS transformation is of very low cost. What you say makes sense though.

juanmanpr gravatar imagejuanmanpr ( 2015-07-25 15:01:39 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2015-07-25 15:07:10 -0500

juanmanpr gravatar image

updated 2015-07-25 15:07:27 -0500

I have found the reason. It comes from the reference Matlab implementation, the comments explain it:

   % compute shape contexts for (transformed) model
   [BH1,mean_dist_1]=sc_compute(Xk',zeros(1,nsamp1),mean_dist_global,nbins_theta,nbins_r,r_inner,r_outer,out_vec_1);

   % compute shape contexts for target, using the scale estimate from
   % the warped model
   % Note: this is necessary only because out_vec_2 can change on each
   % iteration, which affects the shape contexts.  Otherwise, Y does
   % not change.
   [BH2,mean_dist_2]=sc_compute(Y',zeros(1,nsamp2),mean_dist_1,nbins_theta,nbins_r,r_inner,r_outer,out_vec_2);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-07-25 12:13:58 -0500

Seen: 158 times

Last updated: Jul 25 '15