|
@@ -104,21 +104,26 @@ public class DiffImgService {
|
|
private boolean isSimilarWithMasterReport(BugDTO masterReport, File imgFile, String taskId) {
|
|
private boolean isSimilarWithMasterReport(BugDTO masterReport, File imgFile, String taskId) {
|
|
|
|
|
|
String[] masterImgs = masterReport.getImgUrls();
|
|
String[] masterImgs = masterReport.getImgUrls();
|
|
- FingerPrint reportImgFingerPrint = readImgFingerPrint(imgFile);
|
|
|
|
- for (int i = 0; i < masterImgs.length; i++) {
|
|
|
|
- String imgPath2 = genImagePath(taskId, masterReport.getId(), i);
|
|
|
|
- File img = checkFileExist(imgPath2);
|
|
|
|
- if (img == null) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- FingerPrint masterImgFingerPrint = readImgFingerPrint(img);
|
|
|
|
- float sim = masterImgFingerPrint.compare(reportImgFingerPrint);
|
|
|
|
- if (sim > 0.85) {
|
|
|
|
- return true;
|
|
|
|
|
|
+ try {
|
|
|
|
+ FingerPrint reportImgFingerPrint = readImgFingerPrint(imgFile);
|
|
|
|
+ if(reportImgFingerPrint==null) return false;
|
|
|
|
+ for (int i = 0; i < masterImgs.length; i++) {
|
|
|
|
+ String imgPath2 = genImagePath(taskId, masterReport.getId(), i);
|
|
|
|
+ File img = checkFileExist(imgPath2);
|
|
|
|
+ if (img == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ FingerPrint masterImgFingerPrint = readImgFingerPrint(img);
|
|
|
|
+ if(masterImgFingerPrint==null) return false;
|
|
|
|
+ float sim = masterImgFingerPrint.compare(reportImgFingerPrint);
|
|
|
|
+ if (sim > 0.85) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ return false;
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
- return false;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|