zouyu
2025-09-26 3fbbfcc8f509c352c58dc8a126220b49b72ed5a0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.xindao.ocr.smartjavaai.model.table;
 
import ai.djl.inference.Predictor;
import ai.djl.modality.cv.Image;
import cn.smartjavaai.common.entity.R;
import com.xindao.ocr.smartjavaai.config.TableStructureConfig;
import com.xindao.ocr.smartjavaai.entity.TableStructureResult;
import org.apache.commons.pool2.impl.GenericObjectPool;
 
import java.awt.image.BufferedImage;
 
/**
 * 表格结构识别模型
 * @author dwj
 */
public interface TableStructureModel extends AutoCloseable{
 
    /**
     * 加载模型
     * @param config
     */
    void loadModel(TableStructureConfig config);
 
 
    /**
     * 表格结构检测
     * @param image
     * @return
     */
    default R<TableStructureResult> detect(BufferedImage image){
        throw new UnsupportedOperationException("默认不支持该功能");
    }
 
    /**
     * 表格结构检测
     * @param imagePath 图片路径
     * @return
     */
    default R<TableStructureResult> detect(String imagePath) {
        throw new UnsupportedOperationException("默认不支持该功能");
    }
 
    /**
     * 表格结构检测
     * @param imageData 图片字节数组
     * @return
     */
    default R<TableStructureResult> detect(byte[] imageData) {
        throw new UnsupportedOperationException("默认不支持该功能");
    }
 
 
    /**
     * 表格结构检测
     * @param image DJL Image
     * @return
     */
    default R<TableStructureResult> detect(Image image){
        throw new UnsupportedOperationException("默认不支持该功能");
    }
 
    default GenericObjectPool<Predictor<Image, TableStructureResult>> getPool() {
        throw new UnsupportedOperationException("默认不支持该功能");
    }
}