Exemple #1
0
def rowcolParabolaCrossPoint():
	ret1, rowCoeff, nRow, _ = dfile.loadMatrix('data/row_coeff.txt', float)
	ret2, colCoeff, nCol, _ = dfile.loadMatrix('data/col_coeff.txt', float)
	if ret1 != 0 or ret2 != 0:
		print 'curveMap() >> load coeff失败'
		return
	
	for i in xrange(nRow):
		for j in xrange(nRow):
			if j != i:
				x1, y1, x2, y2 = util.parabolaCrossPoint(rowCoeff[i], rowCoeff[j])
				color = 'b.'
				if j == nRow/2:
					color = 'r.'
				plt.plot(x1, y1, color)
				plt.plot(x2, y2, color)
	
	for i in xrange(nCol):
		for j in xrange(nCol):
			if j == nCol/2:
				x1, y1, x2, y2 = util.parabolaCrossPoint(colCoeff[i], colCoeff[j])
				if x1 and y1 and x2 and y2:
					x1, y1, x2, y2 = y1, -x1, y2, -x2
				plt.plot(x1, y1, 'g.')
				plt.plot(x2, y2, 'g.')
	plt.show()
Exemple #2
0
def truePoints():
	ret1, rowCoeff, nRow, _ = dfile.loadMatrix('data/row_coeff.txt', float)
	ret2, colCoeff, nCol, _ = dfile.loadMatrix('data/col_coeff.txt', float)
	if ret1 != 0 or ret2 != 0:
		print 'truePoints() >> load coeff失败'
		return
	
	xLimit = [0, 800]
	ptxs = []
	ptys = []
	
	for i in xrange(nRow):
		ptx = rowCrossPoints(rowCoeff[i], colCoeff, xLimit[0], xLimit[1])
		if len(ptx) != nCol:
			print "truePoints() >> 第%d行的交叉点数: %d<%d" %(i, len(ptx), nCol)
		pty = [util.polyValue(x, rowCoeff[i]) for x in ptx]
		plotFitResult(ptx, pty, rowCoeff[i], None, 'g')
		ptxs.append(ptx)
		ptys.append(pty)
	ptfile.savePoints(ptxs, ptys, 'data/true_pts.txt')
	
	ptxs1 = -np.transpose(ptys)
	ptys1 = np.transpose(ptxs)
	for i in xrange(nCol):
		plotFitResult(ptxs1[i], ptys1[i], colCoeff[i], 1, 'g')
	
	#plt.xlim(-50, 850)
	#plt.ylim(-400, -150)
	plt.show()