Commit 25042025
This commit is contained in:
Binary file not shown.
@@ -3,6 +3,8 @@ package BASS;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.tinylog.Logger;
|
import org.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static Config.SomeCodes.Wait;
|
import static Config.SomeCodes.Wait;
|
||||||
|
|
||||||
|
|
||||||
@@ -121,7 +123,7 @@ public class AudioPlayer {
|
|||||||
iscontinue = false;
|
iscontinue = false;
|
||||||
break;
|
break;
|
||||||
default : {
|
default : {
|
||||||
Wait(100);
|
Wait(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public class SomeCodes {
|
|||||||
Mat resized = new Mat();
|
Mat resized = new Mat();
|
||||||
opencv_imgproc.resize(mat, resized, new org.bytedeco.opencv.opencv_core.Size(width, height));
|
opencv_imgproc.resize(mat, resized, new org.bytedeco.opencv.opencv_core.Size(width, height));
|
||||||
BufferedImage img = converter.convert(matconverter.convert(resized));
|
BufferedImage img = converter.convert(matconverter.convert(resized));
|
||||||
|
resized.release();
|
||||||
return SwingFXUtils.toFXImage(img, null);
|
return SwingFXUtils.toFXImage(img, null);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -163,6 +164,7 @@ public class SomeCodes {
|
|||||||
Mat resized = new Mat();
|
Mat resized = new Mat();
|
||||||
opencv_imgproc.resize(source, resized, thumbsize);
|
opencv_imgproc.resize(source, resized, thumbsize);
|
||||||
opencv_imgcodecs.imwrite(thumbfile, resized);
|
opencv_imgcodecs.imwrite(thumbfile, resized);
|
||||||
|
resized.release();
|
||||||
return thumbfile;
|
return thumbfile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -752,7 +754,8 @@ public class SomeCodes {
|
|||||||
stddev.copyTo(_std);
|
stddev.copyTo(_std);
|
||||||
|
|
||||||
double value = _std.createIndexer().getDouble(0,0);
|
double value = _std.createIndexer().getDouble(0,0);
|
||||||
|
_std.release();
|
||||||
|
laplacian.release();
|
||||||
return Math.pow(value,2);
|
return Math.pow(value,2);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -690,11 +690,15 @@ public class Cameradetail {
|
|||||||
|
|
||||||
|
|
||||||
if (!BestMat.empty()){
|
if (!BestMat.empty()){
|
||||||
|
UMat cloned;
|
||||||
|
synchronized (BestMat){
|
||||||
|
cloned = BestMat.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// save BestMat at quality 9 PNG
|
// save BestMat at quality 9 PNG
|
||||||
String filename = GetFullQualityPhotoPath(directory, prefix);
|
String filename = GetFullQualityPhotoPath(directory, prefix);
|
||||||
|
if (opencv_imgcodecs.imwrite(filename, cloned, parampng)){
|
||||||
if (opencv_imgcodecs.imwrite(filename, BestMat, parampng)){
|
|
||||||
result.setFullres(filename);
|
result.setFullres(filename);
|
||||||
} else System.out.println("TakePhoto failed, Unable to Save FullQUality Photo for camera "+cameratitle.getText());
|
} else System.out.println("TakePhoto failed, Unable to Save FullQUality Photo for camera "+cameratitle.getText());
|
||||||
|
|
||||||
@@ -707,7 +711,7 @@ public class Cameradetail {
|
|||||||
|
|
||||||
// save ReducedMat at 100% JPEG
|
// save ReducedMat at 100% JPEG
|
||||||
String reducedfilename = GetReducedPhotoPath(directory, prefix);
|
String reducedfilename = GetReducedPhotoPath(directory, prefix);
|
||||||
opencv_imgproc.resize(BestMat, ReducedMat, ReducedSize);
|
opencv_imgproc.resize(cloned, ReducedMat, ReducedSize);
|
||||||
if (!opencv_imgcodecs.imwrite(reducedfilename, ReducedMat, paramjpeg)){
|
if (!opencv_imgcodecs.imwrite(reducedfilename, ReducedMat, paramjpeg)){
|
||||||
System.out.println("TakePhoto failed, Unable to Save Reduced Photo for camera "+cameratitle.getText());
|
System.out.println("TakePhoto failed, Unable to Save Reduced Photo for camera "+cameratitle.getText());
|
||||||
} else result.setCompressedfile(reducedfilename);
|
} else result.setCompressedfile(reducedfilename);
|
||||||
@@ -717,6 +721,7 @@ public class Cameradetail {
|
|||||||
result.setCompressedcrop(xy);
|
result.setCompressedcrop(xy);
|
||||||
result.setReducedROI(new Rect(ReducedMatROI.x(), ReducedMatROI.y(), ReducedMatROI.width(), ReducedMatROI.height()));
|
result.setReducedROI(new Rect(ReducedMatROI.x(), ReducedMatROI.y(), ReducedMatROI.width(), ReducedMatROI.height()));
|
||||||
}
|
}
|
||||||
|
cloned.release();
|
||||||
|
|
||||||
} else raise_log("TakePhoto failed, Live View is Empty");
|
} else raise_log("TakePhoto failed, Live View is Empty");
|
||||||
} catch (InterruptedException e){
|
} catch (InterruptedException e){
|
||||||
@@ -735,8 +740,10 @@ public class Cameradetail {
|
|||||||
|
|
||||||
|
|
||||||
public String CropBestMat(String directory, String prefix, Rect ROI){
|
public String CropBestMat(String directory, String prefix, Rect ROI){
|
||||||
UMat cloned = new UMat();
|
UMat cloned;
|
||||||
BestMat.copyTo(cloned);
|
synchronized (BestMat){
|
||||||
|
cloned = BestMat.clone();
|
||||||
|
}
|
||||||
if (!cloned.empty()) {
|
if (!cloned.empty()) {
|
||||||
if (ValidROI(ROI)){
|
if (ValidROI(ROI)){
|
||||||
if (ROIInsideUMat(ROI, cloned)){
|
if (ROIInsideUMat(ROI, cloned)){
|
||||||
@@ -751,6 +758,7 @@ public class Cameradetail {
|
|||||||
} else Logger.error("CropBestMat failed, ROI is outside BestMat");
|
} else Logger.error("CropBestMat failed, ROI is outside BestMat");
|
||||||
} else Logger.error("CropBestMat failed, ROI is invalid");
|
} else Logger.error("CropBestMat failed, ROI is invalid");
|
||||||
} else Logger.error("CropBestMat failed, BestMat is empty");
|
} else Logger.error("CropBestMat failed, BestMat is empty");
|
||||||
|
cloned.release();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -881,6 +889,7 @@ public class Cameradetail {
|
|||||||
if (rect.haveEyes()){
|
if (rect.haveEyes()){
|
||||||
rect.EyesRectangle(LiveMat);
|
rect.EyesRectangle(LiveMat);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1004,11 +1013,14 @@ public class Cameradetail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mat imgmat = new Mat();
|
Mat imgmat = new Mat();
|
||||||
LiveMat.copyTo(imgmat); // copy back to CPU
|
|
||||||
|
LiveMat.copyTo(imgmat);
|
||||||
|
// copy back to CPU
|
||||||
|
|
||||||
setCameraStream(MatToImage(imgmat));
|
setCameraStream(MatToImage(imgmat));
|
||||||
|
imgmat.release();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println(Thread.currentThread().getName()+" interrupted");
|
//System.out.println(Thread.currentThread().getName()+" interrupted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1098,20 +1110,20 @@ public class Cameradetail {
|
|||||||
UMat flippedmat = new UMat();
|
UMat flippedmat = new UMat();
|
||||||
opencv_core.flip(originalmat, flippedmat, 0); // flip vertical
|
opencv_core.flip(originalmat, flippedmat, 0); // flip vertical
|
||||||
flippedmat.copyTo(originalmat);
|
flippedmat.copyTo(originalmat);
|
||||||
flippedmat.close();
|
flippedmat.release();
|
||||||
}
|
}
|
||||||
if (config.isFlipCamera()){
|
if (config.isFlipCamera()){
|
||||||
// revisi 18/03/2025
|
// revisi 18/03/2025
|
||||||
UMat flippedmat = new UMat();
|
UMat flippedmat = new UMat();
|
||||||
opencv_core.flip(originalmat, flippedmat, 1); // flip horizontal
|
opencv_core.flip(originalmat, flippedmat, 1); // flip horizontal
|
||||||
flippedmat.copyTo(originalmat);
|
flippedmat.copyTo(originalmat);
|
||||||
flippedmat.close();
|
flippedmat.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
// rotate 90 degree counter clockwise karena kamera potrait
|
// rotate 90 degree counter clockwise karena kamera potrait
|
||||||
opencv_core.rotate(originalmat, BestMat, opencv_core.ROTATE_90_COUNTERCLOCKWISE);
|
opencv_core.rotate(originalmat, BestMat, opencv_core.ROTATE_90_COUNTERCLOCKWISE);
|
||||||
|
|
||||||
|
originalmat.release();
|
||||||
|
|
||||||
if (!BestMat.empty()) {
|
if (!BestMat.empty()) {
|
||||||
|
|
||||||
@@ -1306,6 +1318,7 @@ public class Cameradetail {
|
|||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
mat.release();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import javafx.stage.DirectoryChooser;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import javafx.scene.control.Alert.AlertType;
|
import javafx.scene.control.Alert.AlertType;
|
||||||
import org.bytedeco.javacv.OpenCVFrameGrabber;
|
import org.bytedeco.javacv.OpenCVFrameGrabber;
|
||||||
@@ -151,6 +152,7 @@ public class CaptureView {
|
|||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_tahan_posisi)){
|
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_tahan_posisi)){
|
||||||
audioPlayer.StopCurrentPlayback();
|
audioPlayer.StopCurrentPlayback();
|
||||||
|
Wait(500);
|
||||||
audioPlayer.PlayFile(audio_tahan_posisi, new PlaybackStatus() {
|
audioPlayer.PlayFile(audio_tahan_posisi, new PlaybackStatus() {
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackStarted(String filename) {
|
public void onPlaybackStarted(String filename) {
|
||||||
@@ -160,7 +162,7 @@ public class CaptureView {
|
|||||||
@Override
|
@Override
|
||||||
public void onPlaybackFinished(String filename) {
|
public void onPlaybackFinished(String filename) {
|
||||||
|
|
||||||
|
Wait(500);
|
||||||
audioPlayer.PlayFile(audio_countdown, new PlaybackStatus() {
|
audioPlayer.PlayFile(audio_countdown, new PlaybackStatus() {
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackStarted(String filename) {
|
public void onPlaybackStarted(String filename) {
|
||||||
@@ -196,6 +198,7 @@ public class CaptureView {
|
|||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(),audio_posisikan_muka)) {
|
if (!Objects.equals(audioPlayer.getCurrentFile(),audio_posisikan_muka)) {
|
||||||
audioPlayer.StopCurrentPlayback();
|
audioPlayer.StopCurrentPlayback();
|
||||||
|
Wait(500);
|
||||||
audioPlayer.PlayFile(audio_posisikan_muka, null);
|
audioPlayer.PlayFile(audio_posisikan_muka, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,7 +217,9 @@ public class CaptureView {
|
|||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_scan_barcode)) {
|
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_scan_barcode)) {
|
||||||
audioPlayer.StopCurrentPlayback();
|
audioPlayer.StopCurrentPlayback();
|
||||||
|
Wait(500);
|
||||||
audioPlayer.PlayFile(audio_scan_barcode, null);
|
audioPlayer.PlayFile(audio_scan_barcode, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,6 +261,8 @@ public class CaptureView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AtomicInteger takephoto_failure_counter = new AtomicInteger(0);
|
||||||
|
|
||||||
private void take_photo_lanjutan(String directory, String prefix){
|
private void take_photo_lanjutan(String directory, String prefix){
|
||||||
audioPlayer.PlayFile(audio_camera_shutter, null);
|
audioPlayer.PlayFile(audio_camera_shutter, null);
|
||||||
Size thumbsize = new Size(160,120);
|
Size thumbsize = new Size(160,120);
|
||||||
@@ -322,6 +329,7 @@ public class CaptureView {
|
|||||||
System.out.println("Sharpness score: "+score1+", "+score2+", "+score3+", "+score4+", "+score5);
|
System.out.println("Sharpness score: "+score1+", "+score2+", "+score3+", "+score4+", "+score5);
|
||||||
double lowest = FindLowestValue(score1,score2,score3,score4,score5);
|
double lowest = FindLowestValue(score1,score2,score3,score4,score5);
|
||||||
if (lowest<=config.getSharpnessThreshold()){
|
if (lowest<=config.getSharpnessThreshold()){
|
||||||
|
// jelek
|
||||||
String culprit = "";
|
String culprit = "";
|
||||||
if (lowest==score1) culprit = "camera 1";
|
if (lowest==score1) culprit = "camera 1";
|
||||||
else if (lowest==score2) culprit = "camera 2";
|
else if (lowest==score2) culprit = "camera 2";
|
||||||
@@ -329,9 +337,29 @@ public class CaptureView {
|
|||||||
else if (lowest==score4) culprit = "camera 4";
|
else if (lowest==score4) culprit = "camera 4";
|
||||||
else if (lowest==score5) culprit = "camera 5";
|
else if (lowest==score5) culprit = "camera 5";
|
||||||
String lowest_string = String.format("%.2f", lowest);
|
String lowest_string = String.format("%.2f", lowest);
|
||||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at "+culprit+" with sharpness score "+lowest_string, 5, null);
|
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at "+culprit+" with sharpness score "+lowest_string, 5, s -> isTakingPhoto.set(false));
|
||||||
isTakingPhoto.set(false);
|
takephoto_failure_counter.incrementAndGet();
|
||||||
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
|
if (takephoto_failure_counter.get() < 2){
|
||||||
|
if (!Objects.equals(audio_pengambilan_gagal, audioPlayer.getCurrentFile())){
|
||||||
|
audioPlayer.StopCurrentPlayback();
|
||||||
|
Wait(500);
|
||||||
|
audioPlayer.PlayFile(audio_pengambilan_gagal, null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!Objects.equals(audio_hubungi_staf_kami, audioPlayer.getCurrentFile())){
|
||||||
|
audioPlayer.StopCurrentPlayback();
|
||||||
|
Wait(500);
|
||||||
|
audioPlayer.PlayFile(audio_hubungi_staf_kami, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
// bagus
|
||||||
|
takephoto_failure_counter.set(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -490,6 +518,7 @@ public class CaptureView {
|
|||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(),audio_pengambilan_berhasil)){
|
if (!Objects.equals(audioPlayer.getCurrentFile(),audio_pengambilan_berhasil)){
|
||||||
audioPlayer.StopCurrentPlayback();
|
audioPlayer.StopCurrentPlayback();
|
||||||
|
Wait(500);
|
||||||
audioPlayer.PlayFile(audio_pengambilan_berhasil, new PlaybackStatus() {
|
audioPlayer.PlayFile(audio_pengambilan_berhasil, new PlaybackStatus() {
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackStarted(String filename) {
|
public void onPlaybackStarted(String filename) {
|
||||||
@@ -498,7 +527,7 @@ public class CaptureView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackFinished(String filename) {
|
public void onPlaybackFinished(String filename) {
|
||||||
AutoCloseAlert.showpictures(prc.compressed(),2, (s)->{
|
AutoCloseAlert.showpictures(prc.compressed(),3, (s)->{
|
||||||
if (AutoCloseAlert.banner_02!=null) {
|
if (AutoCloseAlert.banner_02!=null) {
|
||||||
System.out.println("Showing banner 02 after photo taken");
|
System.out.println("Showing banner 02 after photo taken");
|
||||||
AutoCloseAlert.showbanner(AutoCloseAlert.banner_02, 0, null);
|
AutoCloseAlert.showbanner(AutoCloseAlert.banner_02, 0, null);
|
||||||
@@ -523,6 +552,7 @@ public class CaptureView {
|
|||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(),audio_pengambilan_gagal)){
|
if (!Objects.equals(audioPlayer.getCurrentFile(),audio_pengambilan_gagal)){
|
||||||
audioPlayer.StopCurrentPlayback();
|
audioPlayer.StopCurrentPlayback();
|
||||||
|
Wait(500);
|
||||||
audioPlayer.PlayFile(audio_pengambilan_gagal, null);
|
audioPlayer.PlayFile(audio_pengambilan_gagal, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -576,6 +606,7 @@ public class CaptureView {
|
|||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_upload_gagal)){
|
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_upload_gagal)){
|
||||||
audioPlayer.StopCurrentPlayback();
|
audioPlayer.StopCurrentPlayback();
|
||||||
|
Wait(500);
|
||||||
audioPlayer.PlayFile(audio_upload_gagal, null);
|
audioPlayer.PlayFile(audio_upload_gagal, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -764,6 +795,7 @@ public class CaptureView {
|
|||||||
config.Save();
|
config.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AtomicBoolean anti_bawel = new AtomicBoolean(false);
|
||||||
|
|
||||||
private void SetupCameraWithController(Cameradetail image, String cameraname, int devicenumber){
|
private void SetupCameraWithController(Cameradetail image, String cameraname, int devicenumber){
|
||||||
if (image!=null){
|
if (image!=null){
|
||||||
@@ -904,8 +936,37 @@ public class CaptureView {
|
|||||||
|
|
||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(),audio_posisikan_muka)) {
|
if (!Objects.equals(audioPlayer.getCurrentFile(),audio_posisikan_muka)) {
|
||||||
|
if (!anti_bawel.get()){
|
||||||
audioPlayer.StopCurrentPlayback();
|
audioPlayer.StopCurrentPlayback();
|
||||||
audioPlayer.PlayFile(audio_posisikan_muka, null);
|
Wait(500);
|
||||||
|
audioPlayer.PlayFile(audio_posisikan_muka, new PlaybackStatus() {
|
||||||
|
@Override
|
||||||
|
public void onPlaybackStarted(String filename) {
|
||||||
|
anti_bawel.set(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlaybackFinished(String filename) {
|
||||||
|
anti_bawel.set(false);
|
||||||
|
Thread antibawel = new Thread(()->{
|
||||||
|
try {
|
||||||
|
Thread.sleep(15*1000);
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
|
anti_bawel.set(false);
|
||||||
|
});
|
||||||
|
antibawel.setName("anti bawel");
|
||||||
|
antibawel.setDaemon(true);
|
||||||
|
antibawel.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlaybackFailure(String filename) {
|
||||||
|
anti_bawel.set(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -937,6 +998,8 @@ public class CaptureView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFrontalFaceDetector(boolean hasface, int width, int height) {
|
public void onFrontalFaceDetector(boolean hasface, int width, int height) {
|
||||||
if (hasface!= _have_face.get()){
|
if (hasface!= _have_face.get()){
|
||||||
@@ -951,7 +1014,34 @@ public class CaptureView {
|
|||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_scan_barcode)) {
|
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_scan_barcode)) {
|
||||||
audioPlayer.StopCurrentPlayback();
|
audioPlayer.StopCurrentPlayback();
|
||||||
audioPlayer.PlayFile(audio_scan_barcode, null);
|
if (anti_bawel.get()) return;
|
||||||
|
audioPlayer.PlayFile(audio_scan_barcode, new PlaybackStatus() {
|
||||||
|
@Override
|
||||||
|
public void onPlaybackStarted(String filename) {
|
||||||
|
anti_bawel.set(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlaybackFinished(String filename) {
|
||||||
|
Thread antibawel = new Thread(()->{
|
||||||
|
try {
|
||||||
|
Thread.sleep(15*1000);
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
|
anti_bawel.set(false);
|
||||||
|
});
|
||||||
|
antibawel.setName("anti bawel");
|
||||||
|
antibawel.setDaemon(true);
|
||||||
|
antibawel.start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlaybackFailure(String filename) {
|
||||||
|
anti_bawel.set(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class Detectors {
|
|||||||
private static CascadeClassifier eyeDetector;
|
private static CascadeClassifier eyeDetector;
|
||||||
private static CascadeClassifier profilefaceDetector;
|
private static CascadeClassifier profilefaceDetector;
|
||||||
|
|
||||||
private static double scaleFactor = 1.1;
|
private static double scaleFactor = 1.05;
|
||||||
private final static int minNeighbors = 3;
|
private final static int minNeighbors = 3;
|
||||||
private final static int flags = 0;
|
private final static int flags = 0;
|
||||||
private static Size FaceminSize;
|
private static Size FaceminSize;
|
||||||
@@ -94,7 +94,10 @@ public class Detectors {
|
|||||||
dr.setFace(face);
|
dr.setFace(face);
|
||||||
if (eyes!=null && eyes.size()>=2){
|
if (eyes!=null && eyes.size()>=2){
|
||||||
for(Rect eye : eyes.get()){
|
for(Rect eye : eyes.get()){
|
||||||
if (SomeCodes.IsInsideRect(eye, face)) dr.AddEye(eye);
|
if (SomeCodes.IsInsideRect(eye, face)) {
|
||||||
|
dr.AddEye(eye);
|
||||||
|
System.out.println("face width : " + face.width() + " eye width : " + eye.width());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.add(dr);
|
result.add(dr);
|
||||||
@@ -180,7 +183,7 @@ public class Detectors {
|
|||||||
*/
|
*/
|
||||||
public static RectVector DetectEye(UMat graymat, int facewidth){
|
public static RectVector DetectEye(UMat graymat, int facewidth){
|
||||||
//return Detect(graymat, eyeDetector);
|
//return Detect(graymat, eyeDetector);
|
||||||
int minwidth = Math.max((int)(facewidth*0.25), 24);
|
int minwidth = (int)(facewidth*0.2);
|
||||||
int maxwidth = (int)(facewidth*0.4);
|
int maxwidth = (int)(facewidth*0.4);
|
||||||
Size minsize = new Size(minwidth, minwidth);
|
Size minsize = new Size(minwidth, minwidth);
|
||||||
Size maxsize = new Size(maxwidth, maxwidth);
|
Size maxsize = new Size(maxwidth, maxwidth);
|
||||||
|
|||||||
@@ -24,6 +24,14 @@ public class MainApplication extends Application {
|
|||||||
@Override
|
@Override
|
||||||
public void start(Stage stage) throws IOException {
|
public void start(Stage stage) throws IOException {
|
||||||
|
|
||||||
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||||
|
System.out.println("ShutdownHook Checking running threads...");
|
||||||
|
Map<Thread, StackTraceElement[]> allThreads = Thread.getAllStackTraces();
|
||||||
|
for(Thread thread : allThreads.keySet()){
|
||||||
|
System.out.println("Thread: " + thread.getName()+", State: " + thread.getState()+", Daemon: " + thread.isDaemon());
|
||||||
|
//thread.interrupt();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
SecureDongle sd = new SecureDongle((short)0x4B30, (short)0xA66C, (short)0x3109, (short)0x37B1);
|
SecureDongle sd = new SecureDongle((short)0x4B30, (short)0xA66C, (short)0x3109, (short)0x37B1);
|
||||||
@@ -38,7 +46,7 @@ public class MainApplication extends Application {
|
|||||||
Screen screen = Screen.getPrimary();
|
Screen screen = Screen.getPrimary();
|
||||||
Rectangle2D screenbound = screen.getBounds();
|
Rectangle2D screenbound = screen.getBounds();
|
||||||
Scene scene = new Scene(fxmlLoader.load(), screenbound.getWidth(), screenbound.getHeight());
|
Scene scene = new Scene(fxmlLoader.load(), screenbound.getWidth(), screenbound.getHeight());
|
||||||
stage.setTitle("MultiCam Capture App for ERHA 14042025-041");
|
stage.setTitle("MultiCam Capture App for ERHA 25042025-013");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setResizable(true);
|
stage.setResizable(true);
|
||||||
stage.setMaximized(true);
|
stage.setMaximized(true);
|
||||||
@@ -98,12 +106,7 @@ public class MainApplication extends Application {
|
|||||||
public void stop() throws Exception {
|
public void stop() throws Exception {
|
||||||
Logger.info("Application stopped");
|
Logger.info("Application stopped");
|
||||||
super.stop();
|
super.stop();
|
||||||
System.out.println("Checking running threads...");
|
|
||||||
Map<Thread, StackTraceElement[]> allThreads = Thread.getAllStackTraces();
|
|
||||||
for(Thread thread : allThreads.keySet()){
|
|
||||||
System.out.println("Thread: " + thread.getName()+", State: " + thread.getState()+", Daemon: " + thread.isDaemon());
|
|
||||||
//thread.interrupt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user