package com.xindao.ocr.smartjavaai.model.plate;
|
|
import ai.djl.inference.Predictor;
|
import ai.djl.modality.cv.Image;
|
import ai.djl.modality.cv.output.DetectedObjects;
|
import cn.smartjavaai.common.entity.R;
|
import com.xindao.ocr.smartjavaai.config.PlateDetModelConfig;
|
import com.xindao.ocr.smartjavaai.entity.PlateInfo;
|
import org.apache.commons.pool2.impl.GenericObjectPool;
|
|
import java.awt.image.BufferedImage;
|
import java.io.InputStream;
|
import java.util.List;
|
|
/**
|
* 车牌检测模型
|
* @author dwj
|
*/
|
public interface PlateDetModel extends AutoCloseable{
|
|
/**
|
* 加载模型
|
* @param config
|
*/
|
void loadModel(PlateDetModelConfig config); // 加载模型
|
|
/**
|
* 车牌检测
|
* @param imagePath 图片路径
|
* @return
|
*/
|
default R<List<PlateInfo>> detect(String imagePath) {
|
throw new UnsupportedOperationException("默认不支持该功能");
|
}
|
|
|
/**
|
* 车牌检测
|
* @param inputStream
|
* @return
|
*/
|
default R<List<PlateInfo>> detect(InputStream inputStream) {
|
throw new UnsupportedOperationException("默认不支持该功能");
|
}
|
|
|
/**
|
* 车牌检测
|
* @param base64Image
|
* @return
|
*/
|
default R<List<PlateInfo>> detectBase64(String base64Image){
|
throw new UnsupportedOperationException("默认不支持该功能");
|
}
|
|
|
/**
|
* 车牌检测
|
* @param image BufferedImage
|
* @return
|
*/
|
default R<List<PlateInfo>> detect(BufferedImage image) {
|
throw new UnsupportedOperationException("默认不支持该功能");
|
}
|
|
|
/**
|
* 车牌检测
|
* @param imageData 图片字节数组
|
* @return
|
*/
|
default R<List<PlateInfo>> detect(byte[] imageData) {
|
throw new UnsupportedOperationException("默认不支持该功能");
|
}
|
|
/**
|
* 车牌检测
|
* @param image DJL Image
|
* @return
|
*/
|
default DetectedObjects detect(Image image){
|
throw new UnsupportedOperationException("默认不支持该功能");
|
}
|
|
|
/**
|
* 检测并绘制结果
|
* @param imagePath 图片输入路径(包含文件名称)
|
* @param outputPath 图片输出路径(包含文件名称)
|
*/
|
default R<Void> detectAndDraw(String imagePath, String outputPath) {
|
throw new UnsupportedOperationException("默认不支持该功能");
|
}
|
|
/**
|
* 检测并绘制结果
|
* @param sourceImage
|
* @return
|
*/
|
default R<BufferedImage> detectAndDraw(BufferedImage sourceImage){
|
throw new UnsupportedOperationException("默认不支持该功能");
|
}
|
|
default GenericObjectPool<Predictor<Image, DetectedObjects>> getPool(){
|
throw new UnsupportedOperationException("默认不支持该功能");
|
}
|
|
|
|
|
|
}
|