package com.zzsn.orc;

import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;

public class PicOcr {

    public static List<String> getImageMsg(BufferedImage bufferedImage) throws Exception{
        List<String> msgs=new ArrayList<>();
//        	 logUtil.getLogger().info("---图片切割--");
            BufferedImage splitbufferedImage = PicUtil.img_tailor(bufferedImage, 0,0, 100, 100); // 图片切割
            System.out.println("---图片切割--");
//            splitbufferedImage=PicUtil.changeImge(splitbufferedImage);//图片转黑白
//            String path = "config/image/temp.jpg";//测试的图片位置
//            PicUtil.img2file(splitbufferedImage, "jpg", path);//查看转换的图片
            byte[] splitByte = PicUtil.bufferimage2byte(splitbufferedImage);
            //百度OCR识别信息
            Thread.sleep(3000);
//            String ocrBady = BaiduOCR.imageOcr(splitByte);
//            logUtil.getLogger().info("---BaiduOCR识别--");
            String ocrBady = BaiduOCR.imageBasicGeneralOcr(splitByte);
            List<String> msgList = BaiduOCR.pasermsgJson(ocrBady);
            msgs.addAll(msgList);
        return  msgs;
    }


}
