package com.yinlihupo.enlish.service.omr;

import com.yinlihupo.enlish.service.model.bo.CoordinatesXY;
import com.yinlihupo.enlish.service.model.bo.StudentExamId;
import com.yinlihupo.enlish.service.utils.PngUtil;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import nu.pattern.OpenCV;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Arrays;
import java.util.List;

@SpringBootTest
@Slf4j
public class TestOmr {

    @Value("${templates.data}")
    private String tessdataPath;

    @Test
    public void testOmr(){
        OpenCV.loadLocally();

//        List<Integer> knownIds = Arrays.asList(3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193,
//                3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204,
//                3206, 3208, 3209, 3210, 3211, 3212, 3507, 3508, 3509, 3510,
//                3511, 3512, 3513, 3514, 3515, 3516, 3517, 3519, 3521, 3522,
//                3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532,
//                3533, 3535, 3536, 3537, 3538, 3539);
//
//        List<String> knowsIds = knownIds.stream().map(id -> id + "").toList();
//        String path = "C:\\project\\java\\enlish_edu\\enlish\\enlish-service\\src\\main\\resources\\templates\\p3.png";
//        List<CoordinatesXY> coordinatesXIES = PngUtil.analysisXY(path);


    }

    @Test
    public void testInteger(){
//        String filePath = "C:\\project\\java\\enlish_edu\\enlish\\enlish-service\\src\\main\\resources\\templates\\p3.png";
//        List<CoordinatesXY> coordinatesXIES = PngUtil.analysisXY(filePath);
//        StudentExamId studentExamId = PngUtil.analyzeExamWordsIdAndStudentId(filePath, tessdataPath, coordinatesXIES);
//        log.info("studentExamId:{}",studentExamId);
    }
}
