Problem with Transform.SimilarityTransform

Jean K jean.kossaifi at gmail.com
Fri Dec 6 06:36:35 EST 2013


Great, thanks!

On Wednesday, 4 December 2013 15:54:39 UTC, Johannes Schönberger wrote:
>
> The implementation of the null space solver and especially the 
> normalization is indeed not suitable for this special case. I'll quickly 
> fix it in the coming days...
>
> Am 04.12.2013 um 13:16 schrieb "Jean K" <jean.k... at gmail.com <javascript:>
> >:
>
> Hi everyone,
>
> I'm currently trying to use skleanr.Transform.SimilarityTransform to 
> remove scaling translation and rotation from one set of points to align it 
> to the other.
> However, if I centre the sets around the origin first, there seems to be 
> frequently a problem (which doesn't occur if the points are all positives), 
> the output being NaN.
>
> I tried to write a small reproducible code:
> In [77]:
>
> #I fixed the seed here for reproducibility but this happens often
>
> np.random.seed(4)
>
>  
>
> #Two random set of points
>
> a = np.random.randn(10, 2)
>
> b = np.random.randn(10, 2)
>
>  
>
> # Center the points arount the origin
>
> a -= np.mean(a, axis=0)[np.newaxis, :]
>
> b -= np.mean(b, axis=0)[np.newaxis, :]
>
>  
>
> tform = SimilarityTransform()
>
> tform.estimate(a, b)
>
> tform(a)
>
> Out[77]:
>
> array([[ nan,  nan],
>        [ nan,  nan],
>        [ nan,  nan],
>        [ nan,  nan],
>        [ nan,  nan],
>        [ nan,  nan],
>        [ nan,  nan],
>        [ nan,  nan],
>        [ nan,  nan],
>        [ nan,  nan]])
>
>
> Note that if I don't centre the point there is no problem:
>
> In [89]:
>
> #I fixed the seed here for reproducibility but this happens often
>
> np.random.seed(4)
>
>  
>
> #Two random set of points
>
> a = np.random.randn(10, 2)
>
> b = np.random.randn(10, 2)
>
>  
>
> # Center the points arount the origin
>
> #a -= np.mean(a, axis=0)[np.newaxis, :]
>
> #b -= np.mean(b, axis=0)[np.newaxis, :]
>
>  
>
> tform = SimilarityTransform()
>
> tform.estimate(a, b)
>
> tform(a)
>
> Out[89]:
>
> array([[ 3.76870886, -0.35152078],
>        [ 1.83453334, -1.25080725],
>        [ 5.42428044, -4.30088121],
>        [ 2.51364241, -1.00154154],
>        [ 6.14244682, -2.71511189],
>        [ 5.37956586, -0.65190768],
>        [ 4.5752074 , -0.19039746],
>        [ 1.96968262, -1.99729896],
>        [ 1.47865106,  0.59493455],
>        [ 5.39473376, -0.31125435]])
>
>
> Sometime it also tells me that the *SVD doesn't converge*.
>
> Any idea what is going on?
>
>
> Thanks,
>
>
> Jean 
>
>  -- 
> You received this message because you are subscribed to the Google Groups 
> "scikit-image" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to scikit-image... at googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20131206/0b7a991b/attachment.html>


More information about the scikit-image mailing list