def test_rotate_square():
    N=501
    x=modified_shepp_logan((N,N,3))[:,:,1]
    x=numpy.array(x)
    for angle in [0.0, 10.0,45.0,90.0,150.0,180.0,210.0]:
        r_rot=ref.rotate_square(x,angle)
        o_rot=ocv.rotate_square(x,angle)
        mssim=MSSIM(r_rot,o_rot,16)
        print angle,mssim.min()
        if not (numpy.min(mssim)>0.90).all():
            pylab.figure()
            pylab.subplot(121)
            pylab.imshow(mssim)
            pylab.colorbar()
            pylab.subplot(122)
            pylab.imshow(r_rot-o_rot)
            pylab.colorbar()
            pylab.show()
            assert False
def test_rotate_square():
    N=501
    x=modified_shepp_logan((N,N,3))[:,:,1]
    x=numpy.array(x)
    for angle in [0.0, 10.0,45.0,90.0,150.0,180.0,210.0]:
        r_rot=ref.rotate_square(x,angle)
        i_rot=ispmd.rotate_square(x,angle)
        mssim=MSSIM(r_rot,i_rot,16)
        mssim=scipy.ndimage.median_filter(mssim,3)
        print angle,mssim.min()
        if not (numpy.min(mssim)>0.9).all():
            pylab.figure()
            pylab.subplot(121)
            pylab.imshow(mssim)
            pylab.colorbar()
            pylab.subplot(122)
            pylab.imshow(r_rot-i_rot)
            pylab.colorbar()
            pylab.show()
            assert False