表格化构建系统-加入新的系统功能
要实现的功能
1.图片识别表格化重建
2.保存识别记录,可以查看自己的记录
3.分析记录并统计总结
4.能够将所有的记录形成一个完整的个人总结性表格
部分代码:
package org.example;//import com.sun.media.sound.InvalidFormatException; import net.sourceforge.tess4j.ITesseract; import net.sourceforge.tess4j.Tesseract; import net.sourceforge.tess4j.TesseractException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.ss.usermodel.*; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void main(String[] args) throws InvalidFormatException, IOException, TesseractException { ITesseract instance = new Tesseract(); instance.setDatapath("src/main/resources/tessdata");
instance.setLanguage("chi_sim"); String result = instance.doOCR(new File("src/main/resources/image.png")); String[] lines = result.split("\r?\n"); Workbook workbook = WorkbookFactory.create(new File("src/main/resources/table.xlsx")); Sheet sheet = workbook.getSheetAt(0); int rowCount = 0; for (String line : lines) { Row row = sheet.createRow(rowCount++); int columnCount = 0; for (String word : line.split("\s+")) { Cell cell = row.createCell(columnCount++); cell.setCellValue(word); } } File file = new File("src/main/resources/table_from_image.xlsx"); workbook.write(new FileOutputStream(file)); workbook.close(); } }
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>菜鸟教程</title>
<link rel="stylesheet" href="css/side.css">
</head>
<body>
<div class="sidenav">
<a href="http://localhost:8080/imageExcel_war_exploded/A1.html">关于我们</a>
<a href="http://localhost:8080/imageExcel_war_exploded/A2.html">数据统计</a>
<a href="http://localhost:8080/imageExcel_war_exploded/A3.html">我的记录</a>
<a href="http://localhost:8080/imageExcel_war_exploded/A4.html">图片转化</a>
</div>
<div id="tabs-1" style="display: block">
<form action="SubwayLine" >
<table style="border-width: 0; width: 100%">
<tr>
<table border="1" style="border-left-color: #B0C4DE; border-bottom-color: #B0C4DE; width: 100%;border-top-style: solid; border-top-color: #B0C4DE; border-right-style: solid; border-left-style: solid; height: 250px; border-right-color: #B0C4DE; border-bottom-style: hidden">
<tr align="center"><td align="center" colspan="2">石家庄铁道大学北京地铁线路查询</td></tr>
<tr><td style="width: 30%" align="center">线路名称:</td><td style="width: 70%" align="center"> <select name="line" style="height:40px;width:300px;">
<option value="1号线">1号线</option>
<option value="2号线">2号线</option>
<option value="4号线">4号线</option>
</select></td></tr>
<tr>
<td style="width: 50%" align="center" colspan="2"><input type="submit" style="height:40px;width:300px;" value="查询"/></td>
</tr>
</table>
</tr>
</table>
</form>
</div>
<hr />
<div style="text-align: center; width: 100%; font-size: 12px; color: #333;">©版权所有:石家庄铁道大学信息科学与技术学院</div>
</body>
</html>
作者:冰稀饭Aurora
出处:https://www.cnblogs.com/rsy-bxf150/p/17298997.html
版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端