├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .mvn ├── jvm.config └── settings.xml ├── LICENSE ├── Mod-Detection-Tools.iml ├── README.md ├── pom.xml └── src ├── main ├── java │ └── us │ │ └── warframestat │ │ └── moddetection │ │ └── gui │ │ ├── MainApplication.java │ │ ├── Manager.java │ │ ├── RunApplication.java │ │ ├── controllers │ │ ├── FileSelectController.java │ │ └── ModDetectionController.java │ │ └── exceptions │ │ └── BaseRuntimeException.java └── resources │ ├── fxml │ ├── fileSelect.fxml │ └── opencv.fxml │ └── log4j.properties └── test ├── java └── us │ └── warframestat │ └── moddetection │ └── gui │ └── ControllerTest.java └── resources └── images ├── 1.jpg ├── 2.jpg ├── 3.jpg ├── 4.jpg ├── 5.jpg ├── 6.jpg └── 7.jpg /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | - push 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v2 11 | - name: Set up JDK 16 12 | uses: actions/setup-java@v2 13 | with: 14 | java-version: '16' 15 | distribution: 'temurin' 16 | - name: Verify 17 | run: mvn --batch-mode --update-snapshots verify -s .mvn/settings.xml 18 | env: 19 | MAVEN_TOKEN: ${{ secrets.GH_TOKEN }} 20 | MAVEN_USER: ${{ secrets.GIT_AUTHOR_NAME }} 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | # ignore the sentry API file 15 | *log4j-sentry.properties 16 | 17 | #ignore intellij specific folders 18 | .idea/ 19 | *.iml 20 | 21 | #ignore debug files 22 | image.jpg 23 | 24 | target/ 25 | -------------------------------------------------------------------------------- /.mvn/jvm.config: -------------------------------------------------------------------------------- 1 | --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED 2 | --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED 3 | --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED 4 | --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED 5 | --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -------------------------------------------------------------------------------- /.mvn/settings.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | github 9 | ${env.MAVEN_USER} 10 | ${env.MAVEN_TOKEN} 11 | 12 | 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Warframe Community Developers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Mod-Detection-Tools.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mod-Detection-Tools 2 | 3 | [![Supported by the Warframe Community Developers](https://img.shields.io/badge/Warframe_Comm_Devs-supported-blue.svg?color=2E96EF&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyOTgiIGhlaWdodD0iMTczIiB2aWV3Qm94PSIwIDAgMjk4IDE3MyI%2BPHBhdGggZD0iTTE4NSA2N2MxNSA4IDI4IDE2IDMxIDE5czIzIDE4LTcgNjBjMCAwIDM1LTMxIDI2LTc5LTE0LTctNjItMzYtNzAtNDUtNC01LTEwLTEyLTE1LTIyLTUgMTAtOSAxNC0xNSAyMi0xMyAxMy01OCAzOC03MiA0NS05IDQ4IDI2IDc5IDI2IDc5LTMwLTQyLTEwLTU3LTctNjBsMzEtMTkgMzYtMjIgMzYgMjJ6TTU1IDE3M2wtMTctM2MtOC0xOS0yMC00NC0yNC01MC01LTctNy0xMS0xNC0xNWwxOC0yYzE2LTMgMjItNyAzMi0xMyAxIDYgMCA5IDIgMTQtNiA0LTIxIDEwLTI0IDE2IDMgMTQgNSAyNyAyNyA1M3ptMTYtMTFsLTktMi0xNC0yOWEzMCAzMCAwIDAgMC04LThoN2wxMy00IDQgN2MtMyAyLTcgMy04IDZhODYgODYgMCAwIDAgMTUgMzB6bTE3MiAxMWwxNy0zYzgtMTkgMjAtNDQgMjQtNTAgNS03IDctMTEgMTQtMTVsLTE4LTJjLTE2LTMtMjItNy0zMi0xMy0xIDYgMCA5LTIgMTQgNiA0IDIxIDEwIDI0IDE2LTMgMTQtNSAyNy0yNyA1M3ptLTE2LTExbDktMiAxNC0yOWEzMCAzMCAwIDAgMSA4LThoLTdsLTEzLTQtNCA3YzMgMiA3IDMgOCA2YTg2IDg2IDAgMCAxLTE1IDMwem0tNzktNDBsLTYtNmMtMSAzLTMgNi02IDdsNSA1YTUgNSAwIDAgMSAyIDB6bS0xMy0yYTQgNCAwIDAgMSAxLTJsMi0yYTQgNCAwIDAgMSAyLTFsNC0xNy0xNy0xMC04IDcgMTMgOC0yIDctNyAyLTgtMTItOCA4IDEwIDE3em0xMiAxMWE1IDUgMCAwIDAtNC0yIDQgNCAwIDAgMC0zIDFsLTMwIDI3YTUgNSAwIDAgMCAwIDdsNCA0YTYgNiAwIDAgMCA0IDIgNSA1IDAgMCAwIDMtMWwyNy0zMWMyLTIgMS01LTEtN3ptMzkgMjZsLTMwLTI4LTYgNmE1IDUgMCAwIDEgMCAzbDI2IDI5YTEgMSAwIDAgMCAxIDBsNS0yIDItMmMxLTIgMy01IDItNnptNS00NWEyIDIgMCAwIDAtNCAwbC0xIDEtMi00YzEtMy01LTktNS05LTEzLTE0LTIzLTE0LTI3LTEzLTIgMS0yIDEgMCAyIDE0IDIgMTUgMTAgMTMgMTNhNCA0IDAgMCAwLTEgMyAzIDMgMCAwIDAgMSAxbC0yMSAyMmE3IDcgMCAwIDEgNCAyIDggOCAwIDAgMSAyIDNsMjAtMjFhNyA3IDAgMCAwIDEgMSA0IDQgMCAwIDAgNCAwYzEtMSA2IDMgNyA0aC0xYTMgMyAwIDAgMCAwIDQgMiAyIDAgMCAwIDQgMGw2LTZhMyAzIDAgMCAwIDAtM3oiIGZpbGw9IiMyZTk2ZWYiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg%3D%3D)](https://github.com/WFCD/banner/blob/master/PROJECTS.md) 4 | [![Discord](https://img.shields.io/discord/256087517353213954.svg?logo=discord)](https://discord.gg/jGZxH9f) 5 | [![CI](https://github.com/WFCD/Mod-Detection-Tools/actions/workflows/ci.yml/badge.svg)](https://github.com/WFCD/Mod-Detection-Tools/actions/workflows/ci.yml) 6 | 7 | Tool(s) for tinkering with specific OpenCV settings to help tweak and tune the detection settings for OpenCV and the detection of mods inside an image. 8 | 9 | ## Requirements 10 | - Java 16 or higher 11 | - Private Access Token with `read:packages` in maven settings.xml. [See here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-with-a-personal-access-token) for instructions 12 | 13 | ## Building 14 | Just build it, and run from `main()` in `RunApplication.java` 15 | 16 | ## Usage (v0.01) 17 | Currently very strict. Screenshot and crop an image of the Mods screen in Warframe similar to the examples in 18 | ``` 19 | src/test/resources/images/* 20 | ``` 21 | Change the sliders and cascade dropdown to tune the settings so it detects all the mods in the image. 22 | 23 | ## OpenCV? Image Recognition? 24 | Yes, as an overkill for mod recognition I've trained an OpenCV Cascade file to recognise any Warframe mod (standard, prime and riven mods). The cascade took over 35 CPU days to create. 25 | 26 | ## Tess4J? 27 | Tess4J is a Java library that uses the Tesseract OCR engine to read text from images. 28 | 29 | This means you must have Tesseract (tesseract, tesseract-data-eng) for this to function properly. 30 | 31 | Download Tesseract [here](https://tesseract-ocr.github.io/tessdoc/#binaries) 32 | 33 | ## Important Information 34 | I'm new to JavaFx (been a backend Java dev for a long time) so there may be parts of JavaFX which breaches the acceptable '[wtf](https://s-media-cache-ak0.pinimg.com/236x/ff/68/a5/ff68a5a9d71c3eea9ae4f9e8fed469d1.jpg)' code review scale. 35 | 36 | This is the beginning of a much bigger project which I hope all ties in in the next few months. 37 | 38 | I will be using issues to keep track of bugs and features, both created by the community or myself 39 | 40 | ## ChangeLog 41 | 42 | v0.01 - Init commit, very strict usage -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | us.warframestat 5 | moddetection-gui 6 | 1.0-SNAPSHOT 7 | 8 | 17.0.0.1 9 | 16 10 | 16 11 | 12 | 13 | 14 | com.getsentry.raven 15 | raven-log4j 16 | 8.0.3 17 | 18 | 19 | org.json 20 | json 21 | 20211205 22 | 23 | 24 | org.openjfx 25 | javafx-controls 26 | ${javafx.version} 27 | 28 | 29 | org.openjfx 30 | javafx-fxml 31 | ${javafx.version} 32 | 33 | 34 | org.openjfx 35 | javafx-swing 36 | ${javafx.version} 37 | 38 | 39 | org.slf4j 40 | slf4j-api 41 | 1.7.32 42 | 43 | 44 | org.slf4j 45 | slf4j-log4j12 46 | 1.7.32 47 | 48 | 49 | us.warframestat 50 | moddetection-api 51 | 0.1.0.5 52 | 53 | 54 | org.junit.jupiter 55 | junit-jupiter 56 | 5.8.2 57 | test 58 | 59 | 60 | 61 | 62 | 63 | github 64 | https://maven.pkg.github.com/WFCD/mod-detection-api 65 | 66 | 67 | 68 | 69 | 70 | 71 | com.coveo 72 | fmt-maven-plugin 73 | 2.13 74 | 75 | 76 | 77 | check 78 | 79 | 80 | 81 | 82 | 83 | com.github.ekryd.sortpom 84 | sortpom-maven-plugin 85 | 3.0.1 86 | 87 | \n 88 | UTF-8 89 | true 90 | scope,groupId,artifactId 91 | groupId,artifactId 92 | 4 93 | false 94 | false 95 | false 96 | 97 | 98 | 99 | sortpom-verify 100 | 101 | verify 102 | 103 | 104 | Stop 105 | 106 | 107 | 108 | 109 | 110 | org.apache.maven.plugins 111 | maven-compiler-plugin 112 | 3.8.1 113 | 114 | ${maven.compiler.source} 115 | ${maven.compiler.target} 116 | 117 | 118 | 119 | org.apache.maven.plugins 120 | maven-surefire-plugin 121 | 2.22.2 122 | 123 | 124 | org.openjfx 125 | javafx-maven-plugin 126 | 0.0.8 127 | 128 | us.warframestat.moddetection.gui.MainApplication 129 | 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /src/main/java/us/warframestat/moddetection/gui/MainApplication.java: -------------------------------------------------------------------------------- 1 | package us.warframestat.moddetection.gui; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Scene; 5 | import javafx.scene.layout.StackPane; 6 | import javafx.stage.Stage; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | 10 | /** Main application class for the login demo application */ 11 | public class MainApplication extends Application { 12 | private static Stage mainStage; 13 | private static Logger logger = LoggerFactory.getLogger(MainApplication.class); 14 | 15 | public static void main(String[] args) { 16 | launch(args); 17 | } 18 | 19 | public static Stage getMainStage() { 20 | return mainStage; 21 | } 22 | 23 | public static void setMainStage(Stage mainStage) { 24 | MainApplication.mainStage = mainStage; 25 | } 26 | 27 | public static void setMaximised(boolean maximised) { 28 | mainStage.setMaximized(maximised); 29 | } 30 | 31 | @Override 32 | public void start(Stage stage) { 33 | logger.info("Starting..."); 34 | 35 | MainApplication.setMainStage(stage); 36 | Scene scene = new Scene(new StackPane()); 37 | 38 | Manager manager = new Manager(scene); 39 | manager.showLoginScreen(); 40 | 41 | stage.setScene(scene); 42 | stage.show(); 43 | } 44 | 45 | public static void setWidth(double width) { 46 | mainStage.setWidth(width); 47 | } 48 | 49 | public static void setHeight(double height) { 50 | mainStage.setHeight(height); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/us/warframestat/moddetection/gui/Manager.java: -------------------------------------------------------------------------------- 1 | package us.warframestat.moddetection.gui; 2 | 3 | import java.awt.image.BufferedImage; 4 | import java.io.IOException; 5 | import java.util.logging.Level; 6 | import java.util.logging.Logger; 7 | import javafx.fxml.FXMLLoader; 8 | import javafx.scene.Parent; 9 | import javafx.scene.Scene; 10 | import us.warframestat.moddetection.gui.controllers.FileSelectController; 11 | import us.warframestat.moddetection.gui.controllers.ModDetectionController; 12 | 13 | /** Scene Manager, tells the scenes when to display * */ 14 | public class Manager { 15 | private Scene scene; 16 | 17 | public Manager(Scene scene) { 18 | this.scene = scene; 19 | } 20 | 21 | public void showLoginScreen() { 22 | try { 23 | FXMLLoader loader = 24 | new FXMLLoader(getClass().getClassLoader().getResource("fxml/fileSelect.fxml")); 25 | scene.setRoot((Parent) loader.load()); 26 | FileSelectController controller = loader.getController(); 27 | controller.initManager(this); 28 | } catch (IOException ex) { 29 | Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, null, ex); 30 | } 31 | } 32 | 33 | public void showOpenCvScene(BufferedImage image, String platform) { 34 | try { 35 | FXMLLoader loader = 36 | new FXMLLoader(getClass().getClassLoader().getResource("fxml/opencv.fxml")); 37 | scene.setRoot((Parent) loader.load()); 38 | ModDetectionController controller = loader.getController(); 39 | controller.initScreen(this, image, platform); 40 | 41 | } catch (IOException ex) { 42 | Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, null, ex); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/us/warframestat/moddetection/gui/RunApplication.java: -------------------------------------------------------------------------------- 1 | package us.warframestat.moddetection.gui; 2 | 3 | public class RunApplication { 4 | /** 5 | * Adds a method to run the application. Had to do this, because the program says that the javafx 6 | * runtime components are missing when running from a class that extends Application. 7 | * 8 | * @param args default args 9 | */ 10 | public static void main(String[] args) { 11 | MainApplication.main(args); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/us/warframestat/moddetection/gui/controllers/FileSelectController.java: -------------------------------------------------------------------------------- 1 | package us.warframestat.moddetection.gui.controllers; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import javafx.event.ActionEvent; 6 | import javafx.fxml.FXML; 7 | import javafx.scene.control.ChoiceBox; 8 | import javafx.scene.control.TextField; 9 | import javafx.stage.FileChooser; 10 | import javax.imageio.ImageIO; 11 | import us.warframestat.moddetection.gui.Manager; 12 | 13 | /** Controls the login screen */ 14 | public class FileSelectController { 15 | @FXML public ChoiceBox platformSelect; 16 | @FXML private TextField fileLocation; 17 | @FXML private Manager manager; 18 | 19 | public void initManager(final Manager manager) { 20 | this.manager = manager; 21 | } 22 | 23 | public void browseFiles(ActionEvent actionEvent) { 24 | FileChooser chooser = new FileChooser(); 25 | chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Images", "*.png", "*.jpg")); 26 | File chosenFile = chooser.showOpenDialog(fileLocation.getScene().getWindow()); 27 | if (chosenFile != null) { 28 | fileLocation.setText(chosenFile.getPath()); 29 | } 30 | } 31 | 32 | public void loadOpenCvScene(ActionEvent actionEvent) throws IOException { 33 | manager.showOpenCvScene( 34 | ImageIO.read(new File(fileLocation.getText())), platformSelect.getValue().toString()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/us/warframestat/moddetection/gui/controllers/ModDetectionController.java: -------------------------------------------------------------------------------- 1 | package us.warframestat.moddetection.gui.controllers; 2 | 3 | import java.awt.image.BufferedImage; 4 | import java.io.File; 5 | import java.io.IOException; 6 | import java.text.DecimalFormat; 7 | import java.util.Map; 8 | import javafx.embed.swing.SwingFXUtils; 9 | import javafx.event.ActionEvent; 10 | import javafx.fxml.FXML; 11 | import javafx.scene.Scene; 12 | import javafx.scene.control.ChoiceBox; 13 | import javafx.scene.control.Label; 14 | import javafx.scene.control.Slider; 15 | import javafx.scene.image.Image; 16 | import javafx.scene.image.ImageView; 17 | import javafx.scene.input.Dragboard; 18 | import javafx.scene.input.TransferMode; 19 | import javax.imageio.ImageIO; 20 | import us.warframestat.moddetection.api.detection.DetectMods; 21 | import us.warframestat.moddetection.gui.MainApplication; 22 | import us.warframestat.moddetection.gui.Manager; 23 | 24 | /** Controls the main application screen */ 25 | public class ModDetectionController { 26 | @FXML public ChoiceBox stageChoice; 27 | @FXML public Slider scaleSlider; 28 | @FXML public Label scaleLabel; 29 | @FXML public Slider neighbourSlider; 30 | @FXML public Label neighbourLabel; 31 | @FXML public Label totalWorthLabel; 32 | @FXML private ImageView imageViewer; 33 | 34 | private Manager manager; 35 | private String platform; 36 | private BufferedImage image; 37 | 38 | public void initScreen(Manager manager, BufferedImage image, String platform) { 39 | this.manager = manager; 40 | this.platform = platform; 41 | 42 | setupImage(image); 43 | 44 | setupDragDrop(); 45 | 46 | setupSliders(); 47 | 48 | runModFinder(); 49 | } 50 | 51 | // sets the values of the labels as they are being changed 52 | private void setupSliders() { 53 | scaleSlider 54 | .valueProperty() 55 | .addListener( 56 | (observable, oldValue, newValue) -> { 57 | DecimalFormat df = new DecimalFormat("#.000"); 58 | String twoDp = df.format(newValue); 59 | scaleLabel.setText(twoDp); 60 | }); 61 | 62 | neighbourSlider 63 | .valueProperty() 64 | .addListener( 65 | (observable, oldValue, newValue) -> { 66 | neighbourLabel.setText(String.valueOf(Math.round((Double) newValue))); 67 | }); 68 | 69 | scaleSlider 70 | .valueChangingProperty() 71 | .addListener( 72 | (obs, wasChanging, isNowChanging) -> { 73 | if (!isNowChanging) { 74 | runModFinder(); 75 | } 76 | }); 77 | neighbourSlider 78 | .valueChangingProperty() 79 | .addListener( 80 | (obs, wasChanging, isNowChanging) -> { 81 | if (!isNowChanging) { 82 | runModFinder(); 83 | } 84 | }); 85 | } 86 | 87 | // sets the drag and drop ability to allow users to drag images into the application 88 | private void setupDragDrop() { 89 | Scene scene = imageViewer.getScene(); 90 | 91 | scene.setOnDragOver( 92 | event -> { 93 | Dragboard db = event.getDragboard(); 94 | if (db.hasFiles() && db.getFiles().size() == 1) { 95 | event.acceptTransferModes(TransferMode.COPY); 96 | } else { 97 | event.consume(); 98 | } 99 | }); 100 | 101 | // Dropping over surface 102 | scene.setOnDragDropped( 103 | event -> { 104 | Dragboard db = event.getDragboard(); 105 | boolean success = false; 106 | if (db.hasFiles()) { 107 | success = true; 108 | for (File file : db.getFiles()) { 109 | try { 110 | setupImage(ImageIO.read(file)); 111 | } catch (IOException ignored) { 112 | /* invalid image */ 113 | } 114 | } 115 | } 116 | event.setDropCompleted(success); 117 | event.consume(); 118 | }); 119 | } 120 | 121 | // setup the image viewer and openCV recogniser 122 | private void setupImage(BufferedImage image) { 123 | imageViewer.setImage(SwingFXUtils.toFXImage(image, null)); 124 | imageViewer.fitWidthProperty().bind(imageViewer.getScene().widthProperty().subtract(200)); 125 | MainApplication.setHeight(400); 126 | MainApplication.setWidth(1200); 127 | stageChoice.getSelectionModel().selectLast(); 128 | 129 | this.image = image; 130 | } 131 | 132 | private void runModFinder() { 133 | try { 134 | runModFinder(null); 135 | } catch (IOException ignored) { 136 | /* invalid image */ 137 | } 138 | } 139 | 140 | // run the image against OpenCV with the adjustable values 141 | private void runModFinder(ActionEvent actionEvent) throws IOException { 142 | String cascadeValue = (String) stageChoice.getValue(); // cascadexx 143 | double scale = scaleSlider.getValue(); 144 | int neighbours = Math.toIntExact(Math.round(neighbourSlider.getValue())); 145 | Map.Entry results = 146 | DetectMods.run(image, cascadeValue, scale, neighbours, platform); 147 | Image imageShown = SwingFXUtils.toFXImage(results.getKey(), null); 148 | imageViewer.setImage(imageShown); 149 | imageViewer.fitWidthProperty().bind(imageViewer.getScene().widthProperty().subtract(200)); 150 | 151 | totalWorthLabel.setText("Total worth: " + results.getValue()); 152 | } 153 | 154 | public void increaseScale(ActionEvent actionEvent) throws IOException { 155 | scaleSlider.setValue(scaleSlider.getValue() + 0.001); 156 | runModFinder(); 157 | } 158 | 159 | public void decreaseScale(ActionEvent actionEvent) { 160 | scaleSlider.setValue(scaleSlider.getValue() - 0.001); 161 | runModFinder(); 162 | } 163 | 164 | public void increaseNeighbour(ActionEvent actionEvent) { 165 | neighbourSlider.setValue(neighbourSlider.getValue() + 1); 166 | runModFinder(); 167 | } 168 | 169 | public void decreaseNeighbour(ActionEvent actionEvent) { 170 | neighbourSlider.setValue(neighbourSlider.getValue() - 1); 171 | runModFinder(); 172 | } 173 | 174 | public void runModFinderAction(ActionEvent actionEvent) { 175 | runModFinder(); 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /src/main/java/us/warframestat/moddetection/gui/exceptions/BaseRuntimeException.java: -------------------------------------------------------------------------------- 1 | package us.warframestat.moddetection.gui.exceptions; 2 | 3 | /** Created by BourneID on 23/01/2017. */ 4 | public class BaseRuntimeException extends RuntimeException { 5 | 6 | public BaseRuntimeException(String message, Throwable cause) { 7 | super(message, cause); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/fxml/fileSelect.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |