a[a60:a70,a40:a50] = 1 a[a40:a50,a50:a60] = 1 a[a30:a40,a60:a70] = 1 a[a60:a70,a60:a70] = 1 b = a b = ndimage.rotate(b, angle, reshape=False, order=1) if shift is not None: b = ndimage.shift(b, shift=shift, mode='wrap', order=1) bnoise = b + noiselevel*numpy.random.random(shape) bnoise = ndimage.median_filter(bnoise, size=2) bnoise = imagenorm.normStdev(bnoise) return bnoise if __name__ == "__main__": u = mem.used() stepsize = 1.0 shape = (256,256) noiselevel = 2.0 a = createDots(angle=0., noiselevel=noiselevel, shape=shape) b = createDots(angle=-30., noiselevel=noiselevel, shape=shape, shift=(3,4)) imagefile.arrayToJpeg(a, "imagea.jpg") imagefile.arrayToJpeg(b, "imageb.jpg") ar = radonTransform(a, stepsize) br = radonTransform(b, stepsize) imagefile.arrayToJpeg(ar, "radona.jpg") imagefile.arrayToJpeg(br, "radonb.jpg") #print "%.3f"%(a[1,0])
(205, 43), (253, 72), (106, 103), (272, 146), (337, 185), (78, 414), (102, 405), (52, 425), (267, 234), (277, 202), (122, 817), (150, 850), (193, 864), (196, 428), (236, 439), (273, 430), )) #print "untilt=",untilt #print "tilt= ",tilt u = mem.used() for i in range(1): #sys.stderr.write(".") e = radermacher.tiltang(untilt, tilt, 1.0) print e f = radermacher.willsq(untilt, tilt, e['wtheta'], 0.0, 0.0) print f print "mem=", mem.used() - u, "\n" print "done" #sys.exit(1)
untilt = numpy.array(( (585,444),(603,473),(573,525),(676,1032),(613,963), (897,905),(972,936),(1044,876),(370,1319),(505,1121), (533,1103),(109,353),(149,321),(199,283),(265,314), (76,335),(298,390),(391,437),(52,647),(85,639), (15,653),(295,477),(310,447),(139,1052),(176,1091), (231,1110),(210,670),(265,680),(316,679), )) tilt = numpy.array(( (483,180),(492,208),(469,261),(524,761),(480,694), (750,647),(697,619),(801,583),(286,1064),(391,856), (415,840),(134,122),(166,87),(205,43),(253,72), (106,103),(272,146),(337,185),(78,414),(102,405), (52,425),(267,234),(277,202),(122,817),(150,850), (193,864),(196,428),(236,439),(273,430), )) #print "untilt=",untilt #print "tilt= ",tilt u = mem.used() for i in range(1): #sys.stderr.write(".") e = radermacher.tiltang(untilt,tilt,1.0) print e f = radermacher.willsq(untilt,tilt,e['wtheta'],0.0,0.0) print f print "mem=",mem.used()-u,"\n" print "done" #sys.exit(1)