我的代碼在.tiff圖像上計算Hu時刻。我需要在輸出中刪除指數(科學)符號,看起來像:在打印NumPy數組時,如何去除指數(科學記數法)?
2.84737313535e-05
1.25610416364e-09
1.25419253619e-09
1.57419718046e-18
6.69242940524e-12
4.17512050223e-22
def humoments(self): #function for HuMoments computation
for filename in glob.iglob ('*.tif'):
img = cv.LoadImageM(filename, cv.CV_LOAD_IMAGE_GRAYSCALE)
cancer = cv.GetHuMoments(cv.Moments(img))
#arr = cancer
arr = numpy.array([cancer])
with open('hu.csv', 'wb') as csvfile:
for elem in arr.flat[:50]:
#print('{}\t'.format(elem)) #this code puts the result to console
writer = csv.writer(csvfile, delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL)
writer.writerow([('{}\t'.format(elem))])
謝謝你幫我