Преглед на файлове

【bug修复】(黄根)完善代码逻辑
【工作量】6h
【评审人】

huanggen преди 1 година
родител
ревизия
967333833b

+ 180 - 19
app/src/main/cpp/native-lib.cpp

@@ -24,14 +24,160 @@ jstring str2jstring(JNIEnv *env, const char *pat)
     return env->NewStringUTF(pat);
 }
 
+
+extern "C"
+JNIEXPORT jstring JNICALL
+Java_com_example_paperidentify_IdentifyNative_preIdentify__Ljava_lang_String_2ILjava_lang_StringBuffer_2Ljava_util_HashMap_2Ljava_lang_String_2(
+        JNIEnv *env, jclass clazz, jstring str_img_path, jint n_school_id, jobject str_card_id,
+        jobject papers_map, jstring str_ip) {
+//    clock_t stratTime = clock();
+    const char * imgPath = env->GetStringUTFChars(str_img_path, 0);
+    const char * ipAddress = env->GetStringUTFChars(str_ip, 0);
+    int nSchoolId = n_school_id;
+    paperPreIdentify tIdentify(nSchoolId);
+    PAPERIDENTIFYSTATUS eStatus = tIdentify.scanPaper(imgPath, ipAddress);
+    env->ReleaseStringUTFChars(str_img_path, imgPath);
+    env->ReleaseStringUTFChars(str_ip, ipAddress);
+    std::string strRet = std::to_string(eStatus);
+
+    //将异常数据存入容器
+    std::map<PaperAbnormalType, std::vector<PaperPage>> resMap = tIdentify.getAbnPapers();
+    std::map<PaperAbnormalType, std::vector<PaperPage>>::iterator iter = resMap.begin();
+    for(; iter != resMap.end(); iter++)
+    {
+        int nKey = iter->first;
+        jclass integerClass = env->FindClass("java/lang/Integer");
+        jmethodID integerConstructorID = env->GetMethodID(integerClass, "<init>", "(I)V");
+        jobject key = env->NewObject(integerClass, integerConstructorID, nKey);
+        std::vector<PaperPage> paperVec = iter->second;
+        int nPaperSize = paperVec.size();
+        jclass mapClass = env->FindClass("java/util/HashMap");
+        jmethodID putMethodID =
+                env->GetMethodID(
+                        mapClass,
+                        "put",
+                        "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;" );
+
+        jclass arrayListClass = env->FindClass("java/util/ArrayList");
+        jmethodID arrayListInit = env->GetMethodID(arrayListClass, "<init>", "()V");
+        jmethodID addToList = env->GetMethodID(
+                arrayListClass,
+                "add",
+                "(Ljava/lang/Object;)Z" );
+        jobject listObj = env->NewObject(arrayListClass, arrayListInit);
+        for(int i = 0; i < nPaperSize; i++)
+        {
+            PaperPage tPage = paperVec.at(i);
+            jstring firstPage = str2jstring(env, tPage.firstPage.c_str());
+            jstring secondPage = str2jstring(env, tPage.secondPage.c_str());
+            env->CallBooleanMethod(listObj, addToList, firstPage);
+            env->CallBooleanMethod(listObj, addToList, secondPage);
+            env->DeleteLocalRef(firstPage);
+            env->DeleteLocalRef(secondPage);
+        }
+        env->CallObjectMethod(papers_map, putMethodID, key, listObj);
+        //资源释放
+        env->DeleteLocalRef(integerClass);
+        env->DeleteLocalRef(key);
+        env->DeleteLocalRef(mapClass);
+        env->DeleteLocalRef(arrayListClass);
+        env->DeleteLocalRef(listObj);
+    }
+    std::string strCardId = tIdentify.getPaperCardId();
+    jstring strPaperId = str2jstring(env, strCardId.c_str());
+    jclass stringBufferClass = env->FindClass("java/lang/StringBuffer");
+    jmethodID appendMethodID =
+            env->GetMethodID(
+                    stringBufferClass,
+                    "append",
+                    "(Ljava/lang/Object;)Ljava/lang/StringBuffer;" );
+    env->CallObjectMethod(str_card_id, appendMethodID, strPaperId);
+    env->DeleteLocalRef(strPaperId);
+    env->DeleteLocalRef(stringBufferClass);
+
+//    clock_t endTime = clock();
+//    double exAustTime = (endTime - stratTime) / CLOCKS_PER_SEC;
+    return str2jstring(env, strRet.c_str());
+}
+
+extern "C"
+JNIEXPORT jstring JNICALL
+Java_com_example_paperidentify_IdentifyNative_preIdentify__Ljava_lang_String_2ILjava_lang_StringBuffer_2Ljava_util_HashMap_2(
+        JNIEnv *env, jclass clazz, jstring str_img_path, jint n_school_id, jobject str_card_id,
+        jobject papers_map) {
+//    clock_t stratTime = clock();
+    const char * imgPath = env->GetStringUTFChars(str_img_path, 0);
+    int nSchoolId = n_school_id;
+    paperPreIdentify tIdentify(nSchoolId);
+    PAPERIDENTIFYSTATUS eStatus = tIdentify.scanPaper(imgPath);
+    env->ReleaseStringUTFChars(str_img_path, imgPath);
+    std::string strRet = std::to_string(eStatus);
+
+    //将异常数据存入容器
+    std::map<PaperAbnormalType, std::vector<PaperPage>> resMap = tIdentify.getAbnPapers();
+    std::map<PaperAbnormalType, std::vector<PaperPage>>::iterator iter = resMap.begin();
+    for(; iter != resMap.end(); iter++)
+    {
+        int nKey = iter->first;
+        jclass integerClass = env->FindClass("java/lang/Integer");
+        jmethodID integerConstructorID = env->GetMethodID(integerClass, "<init>", "(I)V");
+        jobject key = env->NewObject(integerClass, integerConstructorID, nKey);
+        std::vector<PaperPage> paperVec = iter->second;
+        int nPaperSize = paperVec.size();
+        jclass mapClass = env->FindClass("java/util/HashMap");
+        jmethodID putMethodID =
+                env->GetMethodID(
+                        mapClass,
+                        "put",
+                        "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;" );
+
+        jclass arrayListClass = env->FindClass("java/util/ArrayList");
+        jmethodID arrayListInit = env->GetMethodID(arrayListClass, "<init>", "()V");
+        jmethodID addToList = env->GetMethodID(
+                arrayListClass,
+                "add",
+                "(Ljava/lang/Object;)Z" );
+        jobject listObj = env->NewObject(arrayListClass, arrayListInit);
+        for(int i = 0; i < nPaperSize; i++)
+        {
+            PaperPage tPage = paperVec.at(i);
+            jstring firstPage = str2jstring(env, tPage.firstPage.c_str());
+            jstring secondPage = str2jstring(env, tPage.secondPage.c_str());
+            env->CallBooleanMethod(listObj, addToList, firstPage);
+            env->CallBooleanMethod(listObj, addToList, secondPage);
+            env->DeleteLocalRef(firstPage);
+            env->DeleteLocalRef(secondPage);
+        }
+        env->CallObjectMethod(papers_map, putMethodID, key, listObj);
+        //资源释放
+        env->DeleteLocalRef(integerClass);
+        env->DeleteLocalRef(key);
+        env->DeleteLocalRef(mapClass);
+        env->DeleteLocalRef(arrayListClass);
+        env->DeleteLocalRef(listObj);
+    }
+    std::string strCardId = tIdentify.getPaperCardId();
+    jstring strPaperId = str2jstring(env, strCardId.c_str());
+    jclass stringBufferClass = env->FindClass("java/lang/StringBuffer");
+    jmethodID appendMethodID =
+            env->GetMethodID(
+                    stringBufferClass,
+                    "append",
+                    "(Ljava/lang/Object;)Ljava/lang/StringBuffer;" );
+    env->CallObjectMethod(str_card_id, appendMethodID, strPaperId);
+    env->DeleteLocalRef(strPaperId);
+    env->DeleteLocalRef(stringBufferClass);
+
+//    clock_t endTime = clock();
+//    double exAustTime = (endTime - stratTime) / CLOCKS_PER_SEC;
+    return str2jstring(env, strRet.c_str());
+}
+
 extern "C"
 JNIEXPORT jstring JNICALL
-Java_com_example_paperidentify_IdentifyNative_preIdentifyByFileList(JNIEnv *env, jclass clazz,
-                                                                    jobject img_list,
-                                                                    jint n_school_id,
-                                                                    jboolean b_use_test_env,
-                                                                    jobject str_card_id,
-                                                                    jobject papers_map) {
+Java_com_example_paperidentify_IdentifyNative_preIdentifyByFileList__Ljava_util_ArrayList_2ILjava_lang_StringBuffer_2Ljava_util_HashMap_2Ljava_lang_String_2(
+        JNIEnv *env, jclass clazz, jobject img_list, jint n_school_id, jobject str_card_id,
+        jobject papers_map, jstring str_ip) {
     std::vector<std::string> paperVec;
     std::string strRet;
 
@@ -50,9 +196,11 @@ Java_com_example_paperidentify_IdentifyNative_preIdentifyByFileList(JNIEnv *env,
     env->DeleteLocalRef(listClass);
     env->DeleteLocalRef(array);
 
+    const char * ipAddress = env->GetStringUTFChars(str_ip, 0);
     int nSchoolId = n_school_id;
     paperPreIdentify tIdentify(nSchoolId);
-    PAPERIDENTIFYSTATUS eStatus = tIdentify.scanPaper(paperVec, b_use_test_env == JNI_TRUE);
+    PAPERIDENTIFYSTATUS eStatus = tIdentify.scanPaper(paperVec, ipAddress);
+    env->ReleaseStringUTFChars(str_ip, ipAddress);
     strRet = std::to_string(eStatus);
     //将异常数据存入容器
     std::map<PaperAbnormalType, std::vector<PaperPage>> resMap = tIdentify.getAbnPapers();
@@ -116,18 +264,31 @@ Java_com_example_paperidentify_IdentifyNative_preIdentifyByFileList(JNIEnv *env,
 
 extern "C"
 JNIEXPORT jstring JNICALL
-Java_com_example_paperidentify_IdentifyNative_preIdentify(JNIEnv *env, jclass clazz,
-                                                          jstring str_img_path, jint n_school_id,
-                                                          jboolean b_use_test_env,
-                                                          jobject str_card_id, jobject papers_map) {
-    clock_t stratTime = clock();
-    const char * imgPath = env->GetStringUTFChars(str_img_path, 0);
+Java_com_example_paperidentify_IdentifyNative_preIdentifyByFileList__Ljava_util_ArrayList_2ILjava_lang_StringBuffer_2Ljava_util_HashMap_2(
+        JNIEnv *env, jclass clazz, jobject img_list, jint n_school_id, jobject str_card_id,
+        jobject papers_map) {
+    std::vector<std::string> paperVec;
+    std::string strRet;
+
+    //https://stackoverflow.com/questions/24403340/jni-java-arraylist-conversion-to-c-stdstring
+    jclass listClass = env->FindClass("java/util/List");
+    jmethodID mToArray = env->GetMethodID(listClass, "toArray", "()[Ljava/lang/Object;");
+    if(mToArray == NULL)
+        return str2jstring(env, strRet.c_str());
+    jobjectArray array = (jobjectArray)env->CallObjectMethod(img_list, mToArray);
+    for(int i=0; i<env->GetArrayLength(array); i++) {
+        jstring strObj = (jstring)env->GetObjectArrayElement(array, i);
+        const char * chr = env->GetStringUTFChars(strObj, NULL);
+        paperVec.push_back(chr);
+        env->ReleaseStringUTFChars(strObj, chr);
+    }
+    env->DeleteLocalRef(listClass);
+    env->DeleteLocalRef(array);
+
     int nSchoolId = n_school_id;
     paperPreIdentify tIdentify(nSchoolId);
-    PAPERIDENTIFYSTATUS eStatus = tIdentify.scanPaper(imgPath, b_use_test_env == JNI_TRUE);
-    env->ReleaseStringUTFChars(str_img_path, imgPath);
-    std::string strRet = std::to_string(eStatus);
-
+    PAPERIDENTIFYSTATUS eStatus = tIdentify.scanPaper(paperVec);
+    strRet = std::to_string(eStatus);
     //将异常数据存入容器
     std::map<PaperAbnormalType, std::vector<PaperPage>> resMap = tIdentify.getAbnPapers();
     std::map<PaperAbnormalType, std::vector<PaperPage>>::iterator iter = resMap.begin();
@@ -182,8 +343,8 @@ Java_com_example_paperidentify_IdentifyNative_preIdentify(JNIEnv *env, jclass cl
     env->CallObjectMethod(str_card_id, appendMethodID, strPaperId);
     env->DeleteLocalRef(strPaperId);
     env->DeleteLocalRef(stringBufferClass);
+    std::string strRes = "1 : " + std::to_string(resMap[(PaperAbnormalType)1].size()) + "   2 : " + std::to_string(resMap[(PaperAbnormalType)2].size()) + "   3 : " + std::to_string(resMap[(PaperAbnormalType)3].size());
+    __android_log_print(ANDROID_LOG_INFO, "ASDQWE", "%s \n", strRes.c_str());
 
-    clock_t endTime = clock();
-    double exAustTime = (endTime - stratTime) / CLOCKS_PER_SEC;
     return str2jstring(env, strRet.c_str());
 }

+ 33 - 27
app/src/main/cpp/paperPreIdentify.cpp

@@ -86,19 +86,19 @@ paperPreIdentify::~paperPreIdentify()
     m_abnPaperMap.clear();
 }
 
-PAPERIDENTIFYSTATUS paperPreIdentify::scanPaper(string strImgDir, bool bUseTestIp)
+PAPERIDENTIFYSTATUS paperPreIdentify::scanPaper(string strImgDir, string strIp)
 {
     m_vPaperPath.clear();
     m_abnPaperMap.clear();
     traverseDir(strImgDir);
     sort(m_vPaperPath.begin(), m_vPaperPath.end());
-    return preIdentify(m_vPaperPath, bUseTestIp);
+    return preIdentify(m_vPaperPath, strIp);
 }
 
-PAPERIDENTIFYSTATUS paperPreIdentify::scanPaper(std::vector<std::string> papersVec, bool bUseTestIp)
+PAPERIDENTIFYSTATUS paperPreIdentify::scanPaper(std::vector<std::string> papersVec, string strIp)
 {
     sort(papersVec.begin(), papersVec.end());
-    return preIdentify(papersVec, bUseTestIp);
+    return preIdentify(papersVec, strIp);
 }
 
 bool paperPreIdentify::findAnchors(PaperPage sPage)
@@ -122,29 +122,36 @@ string paperPreIdentify::readQrCode(PaperPage sPage)
     {
         string strPath = i == 0 ? sPage.firstPage : sPage.secondPage;
         Mat tImg = imread(strPath);
-        Mat roiMat = tImg(Rect(0, 0, tImg.cols / 4, tImg.rows / 5));
-        Mat imgGray;
-        cvtColor(roiMat, imgGray, CV_BGR2GRAY);  // 灰度化
-        erode(imgGray, imgGray, Mat());     //图片腐蚀,缩小高亮(白色)区域
+        for(int j = 0; j < 2; j++)
+        {
+            int nBegin = j == 0 ? tImg.cols * 3 / 4 : 0;
+            Mat roiMat = tImg(Rect(nBegin, 0, tImg.cols / 4, tImg.rows / 5));
+            Mat imgGray;
+            cvtColor(roiMat, imgGray, CV_BGR2GRAY);  // 灰度化
+            erode(imgGray, imgGray, Mat());     //图片腐蚀,缩小高亮(白色)区域
 //        imwrite("/storage/emulated/0/Pictures/AAA.jpg", imgGray);
 //        //OpenCV自带的QRCode识别方法
 //        QRCodeDetector tDetector;
 //        string strRet1 = tDetector.detectAndDecode(imgGray);
-        m_nAnchorsToQrCode = 0;
-        strRet = ZbarDecoder(imgGray, m_nAnchorsToQrCode);
-        if (strRet.length() > 0)
-            break;
-        else
-        {
-            roiMat = tImg(Rect(tImg.cols * 3 / 4, tImg.rows * 4 / 5, tImg.cols / 4, tImg.rows / 5));
-            cvtColor(roiMat, imgGray, CV_BGR2GRAY);
-            erode(imgGray, imgGray, Mat());     //图片腐蚀,缩小高亮(白色)区域
-            //opencv容易出现识别出二维码但是decode返回空的问题,改用ZBar库识别二维码
+            m_nAnchorsToQrCode = 0;
             strRet = ZbarDecoder(imgGray, m_nAnchorsToQrCode);
-            m_nAnchorsToQrCode += tImg.rows * 4 / 5;
             if (strRet.length() > 0)
                 break;
+            else
+            {
+                nBegin = j == 0 ? 0 : tImg.cols * 3 / 4;
+                roiMat = tImg(Rect(nBegin, tImg.rows * 4 / 5, tImg.cols / 4, tImg.rows / 5));
+                cvtColor(roiMat, imgGray, CV_BGR2GRAY);
+                erode(imgGray, imgGray, Mat());     //图片腐蚀,缩小高亮(白色)区域
+                //opencv容易出现识别出二维码但是decode返回空的问题,改用ZBar库识别二维码
+                strRet = ZbarDecoder(imgGray, m_nAnchorsToQrCode);
+                m_nAnchorsToQrCode += tImg.rows * 4 / 5;
+                if (strRet.length() > 0)
+                    break;
+            }
         }
+        if (strRet.length() > 0)
+            break;
     }
     return strRet;
 }
@@ -178,16 +185,14 @@ void paperPreIdentify::traverseDir(string strImgDir)
     closedir(dir);
 }
 
-bool paperPreIdentify::getCardTemplate(string strCardId, bool bUseTestIp)
+bool paperPreIdentify::getCardTemplate(string strCardId, string strIp)
 {
     string strTaskId;
-    string strIp = "http://jzzy-pre.fxbjy.com";
+    strIp = strIp.empty() ? "http://jzzy-pre.fxbjy.com" : strIp;
     vector<string> strs = splitEx(strCardId, ",");
     strCardId = strs.at(0);
     if(strs.size() == 2)
         strTaskId = strs.at(1);
-    if(bUseTestIp)
-        strIp = /*"http://precision.test.xueping.com"*/"http://192.168.200.101:8060";
     string strSchoolId = to_string(m_nSchoolId);
     string strUrl = strIp + "/teacher/third/card/location?cardId=" + strCardId + "&taskId=" + strTaskId + "&schoolId=" + strSchoolId;
     //调用后端接口获取模板信息
@@ -249,8 +254,8 @@ bool paperPreIdentify::findTopAnchors(Mat tMat)
     //根据图片像素比例调整定位点检查区域高度
     double dLocPointHeight = m_SchemeParam.dAnchorsHeight;
     int nDelta = tMat.rows / m_SchemeParam.dImgHeight;
-    m_SchemeParam.nAnchorsTopRange = dLocPointHeight * 6 * nDelta;
-    m_SchemeParam.nAnchorsBottomRange = dLocPointHeight * 7 * nDelta;
+    m_SchemeParam.nAnchorsTopRange = dLocPointHeight * 9 * nDelta;
+    m_SchemeParam.nAnchorsBottomRange = dLocPointHeight * 12 * nDelta;
     if(m_nAnchorsToQrCode > tMat.rows / 2)
         m_SchemeParam.nAnchorsBottomRange = m_nAnchorsToQrCode + (m_SchemeParam.nAnchorsToQrcodeDis - dLocPointHeight) * nDelta - 5;
     else if(m_nAnchorsToQrCode > 0 && m_nAnchorsToQrCode < tMat.rows / 2)
@@ -291,6 +296,7 @@ bool paperPreIdentify::findTopAnchors(Mat tMat)
             cvReleaseStructuringElement(&element);
         CvMemStorage* storage = cvCreateMemStorage(0);
 //        imwrite("/storage/emulated/0/Pictures/ABC.jpg", cvarrToMat(binary_img, true));
+        //轮廓提取
         int contours = cvFindContours(binary_img, storage, &contour, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_NONE, cvPoint(roi[dir].x - 5, roi[dir].y - 5));
         cvReleaseImage(&binary_img);
         cvReleaseImage(&binary_img2);
@@ -530,7 +536,7 @@ int paperPreIdentify::getBalckAreaCount(Mat& tMat)
 
 }
 
-PAPERIDENTIFYSTATUS paperPreIdentify::preIdentify(vector<string> papersVec, bool bUseTestIp) {
+PAPERIDENTIFYSTATUS paperPreIdentify::preIdentify(vector<string> papersVec, string strIp) {
     vector<PaperPage> tAllPaperList;
     int nPaperSize = papersVec.size();
     if(0 == nPaperSize || nPaperSize % 2 != 0)
@@ -570,7 +576,7 @@ PAPERIDENTIFYSTATUS paperPreIdentify::preIdentify(vector<string> papersVec, bool
             if(qrCodeCountMap.count(strQRCode) == 0)
             {
                 //二维码能正确识别则根据识别出的答题卡ID获取模板信息
-                bool bGetTempSucceful = getCardTemplate(strQRCode, bUseTestIp);
+                bool bGetTempSucceful = getCardTemplate(strQRCode, strIp);
                 if(!bGetTempSucceful)
                 {
                     //获取模板失败答题卡计数

+ 4 - 4
app/src/main/cpp/paperPreIdentify.h

@@ -95,17 +95,17 @@ public:
     ~paperPreIdentify();
 
 public:
-    PAPERIDENTIFYSTATUS scanPaper(std::string strImgDir, bool bUseTestIp = false);                  //扫描指定路径下的答题卡图片
-    PAPERIDENTIFYSTATUS scanPaper(std::vector<std::string> papersVec, bool bUseTestIp = false);     //扫描指定目录的答题卡图片列表
+    PAPERIDENTIFYSTATUS scanPaper(std::string strImgDir, std::string strIp = "");                   //扫描指定路径下的答题卡图片
+    PAPERIDENTIFYSTATUS scanPaper(std::vector<std::string> papersVec, std::string strIp = "");      //扫描指定目录的答题卡图片列表
     std::map<PaperAbnormalType, std::vector<PaperPage>> getAbnPapers(){ return m_abnPaperMap; }
     std::string getPaperCardId(){ return m_sCardId; }
 
 private:
-    PAPERIDENTIFYSTATUS preIdentify(std::vector<std::string> papersVec, bool bUseTestIp = false);   //预识别主逻辑
+    PAPERIDENTIFYSTATUS preIdentify(std::vector<std::string> papersVec, std::string strIp);         //预识别主逻辑
     bool findAnchors(PaperPage);                                                                    //查找答题卡图片定位点,成功返回true,失败返回false
     std::string readQrCode(PaperPage);                                                              //读取答题卡二维码信息
     void traverseDir(std::string strImgDir);                                                        //遍历图片文件夹
-    bool getCardTemplate(std::string, bool bUseTestIp = false);                                     //获取答题卡模板信息
+    bool getCardTemplate(std::string, std::string strIp);                                           //获取答题卡模板信息
     bool findTopAnchors(Mat tMat);                                                                  //查找答题卡顶部定位点
     bool findBottomAnchors(Mat tMat, std::vector<CvRect>& locate_point_list);                            //查找答题卡底部定位点
     void scaleSchemeParam(const SchemeParam& default_schema_const_param,

+ 4 - 2
app/src/main/java/com/example/paperidentify/IdentifyNative.java

@@ -11,6 +11,8 @@ public class IdentifyNative {
      * A native method that is implemented by the 'paperidentify' native library,
      * which is packaged with this application.
      */
-    public static native String preIdentify(String strImgPath, int nSchoolId, boolean bUseTestEnv, StringBuffer strCArdId, HashMap<Integer, ArrayList<String>> papersMap);
-    public static native String preIdentifyByFileList(ArrayList<String> imgList, int nSchoolId, boolean bUseTestEnv, StringBuffer strCArdId, HashMap<Integer, ArrayList<String>> papersMap);
+    public static native String preIdentify(String strImgPath, int nSchoolId, StringBuffer strCArdId, HashMap<Integer, ArrayList<String>> papersMap, String strIp);
+    public static native String preIdentify(String strImgPath, int nSchoolId, StringBuffer strCArdId, HashMap<Integer, ArrayList<String>> papersMap);
+    public static native String preIdentifyByFileList(ArrayList<String> imgList, int nSchoolId, StringBuffer strCArdId, HashMap<Integer, ArrayList<String>> papersMap, String strIp);
+    public static native String preIdentifyByFileList(ArrayList<String> imgList, int nSchoolId, StringBuffer strCArdId, HashMap<Integer, ArrayList<String>> papersMap);
 }

+ 5 - 4
app/src/main/java/com/example/paperidentify/MainActivity.java

@@ -26,10 +26,10 @@ public class MainActivity extends AppCompatActivity {
         // Example of a call to a native method
 //        TextView tv = binding.sampleText;
 //        tv.setText(stringFromJNI());
-        String strImgPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/1659689714280";
+        String strImgPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/1668647627295";
         ArrayList<String> imgList = new ArrayList<String>();
-        String strPaperPath1 = strImgPath + "/54_1658455683712_A.jpg";
-        String strPaperPath2 = strImgPath + "/54_1658455683744_B.jpg";
+        String strPaperPath1 = strImgPath + "/1_1684305527759_A.jpg";
+        String strPaperPath2 = strImgPath + "/1_1684305527792_B.jpg";
         imgList.add(strPaperPath1);
         imgList.add(strPaperPath2);
 //        imgList.add(strPaperPath3);
@@ -39,7 +39,8 @@ public class MainActivity extends AppCompatActivity {
         HashMap<Integer, ArrayList<String>> papersMap = new HashMap<Integer, ArrayList<String>>();
         StringBuffer strCardId = new StringBuffer();
 //        String strText = IdentifyNative.preIdentifyByFileList(imgList, 54, true, strCardId, papersMap);
-        String strText = IdentifyNative.preIdentify(strImgPath, 1, false, strCardId, papersMap);
+        String strIp = "http://182.108.40.54:50100/curriculum-teacher-api-test/";
+        String strText = IdentifyNative.preIdentify(strImgPath, 47, strCardId, papersMap, strIp);
         tv.setText(strText);
     }