Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaqinKang committed Feb 11, 2023
1 parent b0a1168 commit f4762c6
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/autoMarco1080pAnd1440p.java
Original file line number Diff line number Diff line change
Expand Up @@ -539,18 +539,24 @@ public void switchNow(){
}

public double imageDetection(Mat _1weapon_2dead_3setting, String checkItem, boolean debugVerbose) {

Mat outputImage = new Mat();
Mat checkItemMat = Imgcodecs.imread("weapon/" + screenResolution + "/" + checkItem +".jpg");
Imgproc.matchTemplate(_1weapon_2dead_3setting, checkItemMat, outputImage, machMethod);//
Core.MinMaxLocResult confidenceValue = Core.minMaxLoc(outputImage);//find the max value and the location of the max value
if (debugVerbose) {
System.out.println("checkItem: " + checkItem);
System.out.println("screenshot: " +_1weapon_2dead_3setting);
System.out.println("screenResolution: " + screenResolution);
System.out.println("confidenceValue.maxVal = " + confidenceValue.maxVal);
try {
Mat outputImage = new Mat();
Mat checkItemMat = Imgcodecs.imread("weapon/" + screenResolution + "/" + checkItem +".jpg");
Imgproc.matchTemplate(_1weapon_2dead_3setting, checkItemMat, outputImage, machMethod);//
Core.MinMaxLocResult confidenceValue = Core.minMaxLoc(outputImage);//find the max value and the location of the max value
if (debugVerbose) {
System.out.println("checkItem: " + checkItem);
System.out.println("screenshot: " +_1weapon_2dead_3setting);
System.out.println("screenResolution: " + screenResolution);
System.out.println("confidenceValue.maxVal = " + confidenceValue.maxVal);
// out
}
return confidenceValue.maxVal;
} catch (Exception e) {
// output error message to ui
JOptionPane.showMessageDialog(null, "Error: " + e.getMessage());
return 0;
}
return confidenceValue.maxVal;
}

public void playBeep() {
Expand Down

0 comments on commit f4762c6

Please sign in to comment.