python - 从图像上字符的坐标(横坐标和纵坐标)重建文本
问题描述
我已经得到了被包围元素的坐标,这里是代码:
NL = list()
for element in range(0, len(ajustX), 1):
t= (dataList[element], ajustX[element], ajustY[element])
NL.append(t)
NL = sorted(NL, key=lambda element: (element[2], element[1]))
print(type(ajustX), type(ajustY),type(NL),type(dataList))
print("\n"+"ajustX" +str(dataList)+"\n"+"X coordinates "+str(ajustX)+"\n"+"Y coordinates "+str(ajustY)+"\n"+"\n"+"NL:"+str(NL))
这是我按 X 降序对坐标进行排序的输出:
<class 'list'> <class 'list'> <class 'list'> <class 'list'>
letter list['T', 'O', 'T', 'A', 'L', '1', '2', '.', '1', 'O']
X coordinates [28, 116, 205, 295, 384, 917, 1004, 1120, 1184, 1272]
Y coordinates [33, 33, 33, 33, 34, 38, 38, 89, 38, 38]
NL:[('T', 28, 33), ('O', 116, 33), ('T', 205, 33), ('A', 295, 33), ('L', 384, 34), ('1', 917, 38), ('2', 1004, 38), ('1', 1184, 38), ('O', 1272, 38), ('.', 1120, 89)]
我正在寻找一种通过保存在文件中来使用坐标(NL)动态重建图像(即使我有具有不同坐标的图像)的方法。
代码:
for element in range(0, len(NL), 1):
fichier = open("data.txt", "a")
#Do something and write
在保存文件时,我想要:
TOTAL 12.10
感谢您的帮助和建议
解决方案
推荐阅读
- google-cloud-platform - 云运行服务到服务连接 ETIMEDOUT
- c++ - 将 std::string 作为输入传递给 getopt()
- jenkins - 使用 Jenkins 管道在 Jmeter 中记录 API 故障
- nginx - NGINX 缓存在 206 上表现得很奇怪
- sql - 用不同的字符分隔sql
- testing - 寻找可以与 CLI 项目一起使用的测试自动化工具
- python - python中的非均匀等高线图
- css - 努力在 CSS 中正确溢出
- swift - 如何从 Firestore 引用中获取数据?
- asp.net-mvc - Kendo MVC 服务器端分页