From 0728ae3ca28810083fb68aa7559f6fe097c2b0ba Mon Sep 17 00:00:00 2001 From: rdkartono Date: Tue, 27 May 2025 14:47:52 +0700 Subject: [PATCH] commit 27/2025 Tambah Crop Setting --- src/main/java/id/co/gtc/erhacam/Cameradetail.java | 5 +++-- src/main/java/id/co/gtc/erhacam/CaptureView.java | 5 +++-- src/main/java/id/co/gtc/erhacam/Detectors.java | 4 ++-- src/main/java/id/co/gtc/erhacam/MainApplication.java | 11 +++-------- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main/java/id/co/gtc/erhacam/Cameradetail.java b/src/main/java/id/co/gtc/erhacam/Cameradetail.java index e4bf810..e7feca5 100644 --- a/src/main/java/id/co/gtc/erhacam/Cameradetail.java +++ b/src/main/java/id/co/gtc/erhacam/Cameradetail.java @@ -1063,7 +1063,7 @@ public class Cameradetail { // 30 fps means 33 ms per frame // so if grab is quicker than 30 ms , its stale frame try{ - if (mGrabber==null) throw new FrameGrabber.Exception("Grabber is null"); + if (mGrabber==null) throw new Exception("Grabber is null"); Frame frame = mGrabber.grab(); // grab frame delta = System.currentTimeMillis() - now; now = System.currentTimeMillis(); @@ -1093,7 +1093,8 @@ public class Cameradetail { if (Capturing.get()) { try{ - if (mGrabber==null) continue; + if (mGrabber==null) throw new Exception("Grabber is null"); + frame = mGrabber.grab(); } catch (Exception e){ if (Capturing.get()){ diff --git a/src/main/java/id/co/gtc/erhacam/CaptureView.java b/src/main/java/id/co/gtc/erhacam/CaptureView.java index fda25c7..5b5f230 100644 --- a/src/main/java/id/co/gtc/erhacam/CaptureView.java +++ b/src/main/java/id/co/gtc/erhacam/CaptureView.java @@ -815,8 +815,8 @@ public class CaptureView { photoheight = ObsbotMeet2.ModeBest.getHeight(); livewidth = ObsbotMeet2.ModeLive.getWidth(); liveheight = ObsbotMeet2.ModeLive.getHeight(); - reducewidth = ObsbotMeet2.Mode3.getWidth(); - reduceheight = ObsbotMeet2.Mode3.getHeight(); + reducewidth = ObsbotMeet2.Mode2.getWidth(); + reduceheight = ObsbotMeet2.Mode2.getHeight(); } image.SetGrabber(devicenumber,grabber, livewidth,liveheight,photowidth,photoheight,reducewidth,reduceheight, true); @@ -979,6 +979,7 @@ public class CaptureView { checkpatientID.setOnFailed(event -> { PlayFileWithoutEvent(audio_data_barcode_tidak_ditemukan); + clear(); Task failed = (Task) event.getSource(); Throwable t = failed.getException(); final String message = t.getMessage(); diff --git a/src/main/java/id/co/gtc/erhacam/Detectors.java b/src/main/java/id/co/gtc/erhacam/Detectors.java index b62165b..bb4666b 100644 --- a/src/main/java/id/co/gtc/erhacam/Detectors.java +++ b/src/main/java/id/co/gtc/erhacam/Detectors.java @@ -193,12 +193,12 @@ public class Detectors { if (detector!=null && !detector.empty()){ if (graymat!=null && graymat.channels()==1 && !graymat.empty()){ if (minSize!=null && maxSize!=null){ - if (minSize.width()<= maxSize.width() && minSize.height() <= maxSize.height()){ + if (minSize.width()< maxSize.width() && minSize.height() < maxSize.height()){ if (graymat.cols()> minSize.width() && graymat.rows() > minSize.height()) { try { RectVector detected = new RectVector(); // try defaulting minSize and maxSize - detector.detectMultiScale(graymat, detected, scaleFactor, minNeighbors, flags, minSize, maxSize); + detector.detectMultiScale(graymat, detected, scaleFactor, minNeighbors, flags, minSize, new Size()); return detected; } catch (Exception e) { diff --git a/src/main/java/id/co/gtc/erhacam/MainApplication.java b/src/main/java/id/co/gtc/erhacam/MainApplication.java index 8051d54..6f67c89 100644 --- a/src/main/java/id/co/gtc/erhacam/MainApplication.java +++ b/src/main/java/id/co/gtc/erhacam/MainApplication.java @@ -22,6 +22,7 @@ import static Config.SomeCodes.config; public class MainApplication extends Application { + final String version = "27052025-012"; PhotoCleaner photoCleaner; @Override public void start(Stage stage) throws IOException { @@ -49,7 +50,7 @@ public class MainApplication extends Application { Screen screen = Screen.getPrimary(); Rectangle2D screenbound = screen.getBounds(); Scene scene = new Scene(fxmlLoader.load(), screenbound.getWidth(), screenbound.getHeight()); - stage.setTitle("MultiCam Capture App for ERHA 27052025-006"); + stage.setTitle("MultiCam Capture App for ERHA "+version); stage.setScene(scene); stage.setResizable(true); stage.setMaximized(true); @@ -68,6 +69,7 @@ public class MainApplication extends Application { AutoCloseAlert.init(); Logger.info("Application started"); + System.out.println("Application version : " + version+" started"); sd.setEvent(new SecureDongleEvent() { @Override public void onDongleMissing() { @@ -108,13 +110,6 @@ public class MainApplication extends Application { } - @Override - public void stop() throws Exception { - Logger.info("Application stopped"); - super.stop(); - - } - public static void main(String[] args) { SomeCodes.ExtractResource("/tinylog.properties"); launch();