commit 18/08/2025

This commit is contained in:
2025-08-18 16:27:27 +07:00
parent d566e4bc4f
commit f7c74304f5
14 changed files with 195 additions and 113 deletions

View File

@@ -1,4 +1,4 @@
#Tue May 27 10:31:40 WIB 2025
#Mon Aug 18 16:11:28 WIB 2025
AudioPhase1=C\:\\Users\\rdkar\\OneDrive\\Documents\\IntelliJ Project\\ErhaCam\\audio\\phase1.mp3
AudioPhase2=C\:\\Users\\rdkar\\OneDrive\\Documents\\IntelliJ Project\\ErhaCam\\audio\\phase2.mp3
AudioPhase3=C\:\\Users\\rdkar\\OneDrive\\Documents\\IntelliJ Project\\ErhaCam\\audio\\phase3.mp3
@@ -8,21 +8,21 @@ Cam1BottomCrop=20.0
Cam1LeftCrop=8.0
Cam1RightCrop=8.0
Cam1TopCrop=10.0
Cam2BottomCrop=10.0
Cam2LeftCrop=10.0
Cam2RightCrop=10.0
Cam2BottomCrop=20.0
Cam2LeftCrop=8.0
Cam2RightCrop=8.0
Cam2TopCrop=10.0
Cam3BottomCrop=10.0
Cam3LeftCrop=10.0
Cam3RightCrop=10.0
Cam3BottomCrop=20.0
Cam3LeftCrop=8.0
Cam3RightCrop=8.0
Cam3TopCrop=10.0
Cam4BottomCrop=10.0
Cam4LeftCrop=10.0
Cam4RightCrop=10.0
Cam4BottomCrop=20.0
Cam4LeftCrop=8.0
Cam4RightCrop=8.0
Cam4TopCrop=10.0
Cam5BottomCrop=10.0
Cam5LeftCrop=10.0
Cam5RightCrop=10.0
Cam5BottomCrop=20.0
Cam5LeftCrop=8.0
Cam5RightCrop=8.0
Cam5TopCrop=10.0
CameraCenter=
CameraConfigCenter={"Brightness"\:0.0,"Contrast"\:0.0,"Saturation"\:0.0,"Hue"\:0.0,"Gain"\:1.0,"Exposure"\:1.0,"Sharpness"\:0.0,"Gamma"\:0.0,"AutoExposure"\:true,"AutoFocus"\:true,"AutoWhiteBalance"\:true}
@@ -41,8 +41,9 @@ FTPPort=21
FTPUser=user
FlipCamera=false
MirrorCamera=false
PhotoDirectory=C\:\\Users\\rdkar\\OneDrive\\Desktop\\Erha Capture
SharpnessThreshold=300.0
PhotoDirectory=D\:\\Capture
Production=true
SharpnessThreshold=850.0
cascadeMaxSize=360
cascadeMinNeighbors=3
cascadeMinSize=250

Binary file not shown.

View File

@@ -47,6 +47,7 @@ public class ConfigFile {
private @Getter boolean MirrorCamera = false;
private @Getter boolean FlipCamera = false;
private @Getter boolean isProduction = true;
private @Getter double SharpnessThreshold;
@@ -83,6 +84,13 @@ public class ConfigFile {
Load();
}
public void setAPI(boolean isProduction){
if (this.isProduction != isProduction){
this.isProduction = isProduction;
needsave = true;
}
}
public void setCam1TopCrop(String value){
if (ValidDouble(value)){
double v = toDouble(value);
@@ -790,6 +798,7 @@ public class ConfigFile {
if (prop.getProperty("MirrorCamera") == null) allcorrect = false;
if (prop.getProperty("FlipCamera") == null) allcorrect = false;
if (prop.getProperty("SharpnessThreshold") == null) allcorrect = false;
if (prop.getProperty("Production") == null) allcorrect = false;
if (prop.getProperty(CameraConfigEnum.CameraConfigLeft90.toString()) == null) allcorrect = false;
@@ -859,6 +868,7 @@ public class ConfigFile {
if (MainApplication.detectorsList!=null){
MainApplication.detectorsList.forEach((i, d) -> {
if (d != null) {
System.out.println("Setting face detection parameters for detector: " + i);
d.setFaceMaxSize(cascadeMaxSize);
d.setFaceMinSize(cascadeMinSize);
d.setScaleFactor(cascadeScaleFactor);
@@ -873,6 +883,7 @@ public class ConfigFile {
MirrorCamera = toBoolean(prop.getProperty("MirrorCamera"));
FlipCamera = toBoolean(prop.getProperty("FlipCamera"));
isProduction = toBoolean(prop.getProperty("Production"));
SharpnessThreshold = toDouble(prop.getProperty("SharpnessThreshold"));
@@ -945,7 +956,7 @@ public class ConfigFile {
FTPUser = "user";
FTPPass = "password";
FTPPath = "/";
PhotoDirectory = currentDirectory;
PhotoDirectory = "D:\\Capture";
SetDefaultCameraConfig(ConfigLeft90);
SetDefaultCameraConfig(ConfigLeft45);
SetDefaultCameraConfig(ConfigCenter);
@@ -967,7 +978,8 @@ public class ConfigFile {
// Detectors.setScaleFactor(cascadeScaleFactor);
MirrorCamera = false;
FlipCamera = false;
SharpnessThreshold = 300.0;
isProduction = true;
SharpnessThreshold = 850.0;
Cam1TopCrop = 10.0;
Cam1BottomCrop = 20.0;
@@ -1052,6 +1064,7 @@ public class ConfigFile {
prop.setProperty("MirrorCamera", String.valueOf(MirrorCamera));
prop.setProperty("FlipCamera", String.valueOf(FlipCamera));
prop.setProperty("Production", String.valueOf(isProduction));
prop.setProperty("SharpnessThreshold", String.valueOf(SharpnessThreshold));
prop.setProperty("Cam1TopCrop", String.valueOf(Cam1TopCrop));

View File

@@ -9,10 +9,13 @@ import org.tinylog.Logger;
import java.io.File;
import java.io.IOException;
import java.net.ConnectException;
import java.net.URI;
import java.net.UnknownHostException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpTimeoutException;
import java.nio.file.Files;
import java.util.Base64;
import java.util.UUID;
@@ -27,7 +30,7 @@ public class ErhaAPI {
private String auth;
private final String API_URL;
private String API_URL="";
private final Gson gson = new Gson();
@@ -36,11 +39,25 @@ public class ErhaAPI {
* @param isProduction if true will use Production URL, if false will use Staging URL
*/
public ErhaAPI(boolean isProduction){
setProduction(isProduction);
}
public void setProduction(boolean isProduction){
final String API_URL_PROD = "https://connect-api.aryanoble.co.id/api";
final String API_URL_STAGING = "https://connect-api-staging.aryanoble.web.id/api";
API_URL = isProduction ? API_URL_PROD : API_URL_STAGING;
update_auth();
if (isProduction){
if (!API_URL.equals(API_URL_PROD)){
API_URL = API_URL_PROD;
update_auth();
}
} else {
if (!API_URL.equals(API_URL_STAGING)){
API_URL = API_URL_STAGING;
update_auth();
}
}
}
/**
* Set API Username
* @param API_USERNAME API Username
@@ -78,7 +95,7 @@ public class ErhaAPI {
public @NonNull BarcodeHttpResult Validate_Barcode(String Barcode, boolean printdebug){
BarcodeHttpResult bhr = new BarcodeHttpResult();
if (ValidBarCode(Barcode)){
System.out.println("Checking Barcode : " + Barcode +" on "+(config.isProduction()?"Production":"Staging")+" API " );
try (HttpClient client = HttpClient.newHttpClient()) {
int medical_record_detail_id = toInt(Barcode);
HttpRequest request = HttpRequest.newBuilder()
@@ -105,10 +122,26 @@ public class ErhaAPI {
Logger.error("Validate_Barcode failed, status code : " , response.statusCode());
}
} catch (IOException e) {
Logger.error("Validate_Barcode IO Exception, Msg : " , e.getMessage());
} catch (InterruptedException e) {
Logger.error("Validate_Barcode Interrupted Exception, Msg : " , e.getMessage());
} catch (UnknownHostException e) {
// no internet or no DNS
Logger.error("Validate_Barcode UnknownHostException, Msg : " , e.getMessage());
bhr.setStatusCode(0);
bhr.setBody("No internet connection or DNS error");
} catch (ConnectException e) {
// connection refused
Logger.error("Validate_Barcode ConnectException , Msg : " , e.getMessage());
bhr.setStatusCode(-1);
bhr.setBody("Connection refused");
} catch( HttpTimeoutException e){
// timeout
Logger.error("Validate_Barcode HttpTimeoutException, Msg : " , e.getMessage());
bhr.setStatusCode(408);
bhr.setBody("Http Request timeout");
} catch (IOException | InterruptedException e) {
// generic network error
Logger.error("Validate_Barcode IOException/InterruptedException, Msg : " , e.getMessage());
bhr.setStatusCode(-2);
bhr.setBody("Network error: " + e.getMessage());
}
}
@@ -158,7 +191,7 @@ public class ErhaAPI {
endBoundary.getBytes()
);
System.out.println("Uploading file : " + filename + " to " + (config.isProduction()?"Production":"Staging")+" API ");
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(API_URL + "/photobooth/photobooth"))
.header("Authorization", "Basic " + auth)

View File

@@ -5,16 +5,14 @@ import javafx.animation.PauseTransition;
import javafx.animation.Timeline;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.*;
@@ -289,26 +287,37 @@ public class AutoCloseAlert {
double screenwidth = Screen.getPrimary().getBounds().getWidth();
double screenheight = Screen.getPrimary().getBounds().getHeight();
double height = screenheight/4;
double width = height * 21/9;
double height = screenheight/4.0;
double width = height * 21.0/9.0;
VBox root = new VBox(10);
root.setPadding(new Insets(12));
root.setPrefSize(width, height);
root.setAlignment(Pos.CENTER);
List<Node> children = new ArrayList<>();
if (ValidString(header)){
Label headerLabel = new Label(header);
headerLabel.setStyle("-fx-font-weight: bold; -fx-font-size: 28px;");
headerLabel.setWrapText(true);
headerLabel.setMinHeight(height*0.25);
children.add(headerLabel);
headerLabel.setMaxWidth(Double.MAX_VALUE);
headerLabel.prefWidthProperty().bind(root.widthProperty());
root.getChildren().add(headerLabel);
}
if (ValidString(content)){
Label contentLabel = new Label(content);
contentLabel.setWrapText(true);
contentLabel.setStyle("-fx-font-size: 24px;");
contentLabel.setMinHeight(height*0.75);
children.add(contentLabel);
contentLabel.setMaxWidth(Double.MAX_VALUE);
contentLabel.prefWidthProperty().bind(root.widthProperty());
VBox.setVgrow(contentLabel, Priority.ALWAYS);
contentLabel.setAlignment(Pos.TOP_CENTER);
root.getChildren().add(contentLabel);
}
VBox root = new VBox(10, children.toArray(new Node[0]));
root.setPrefSize(width, height);
root.setAlignment(Pos.CENTER);
Scene scene = new Scene(root);
alertStage.setScene(scene);

View File

@@ -905,8 +905,8 @@ public class Cameradetail {
boolean have_left_45_face = false;
int _face_width = 0;
int _face_height = 0;
List<DetectorResult> frontalfaces = detector.HaveFrontalFace(GrayMat.clone());
//System.out.println("camera "+title+ (frontalfaces.isEmpty() ? " no frontal face detected" : " found "+frontalfaces.size()+" frontal faces"));
if (!frontalfaces.isEmpty()){
for(DetectorResult rect : frontalfaces){
if (rect.haveFace() ){
@@ -925,6 +925,7 @@ public class Cameradetail {
// gak punya frontal face
// coba cek punya profile left face 45 gak
List<DetectorResult> Left45Faces = detector.HaveLeft45Face(GrayMat.clone());
//System.out.println("camera "+title+ (Left45Faces.isEmpty() ? " no left 45 face detected" : " found "+Left45Faces.size()+" left 45 faces"));
if (!Left45Faces.isEmpty()){
for(DetectorResult rect : Left45Faces){
if (rect.haveFace()){

View File

@@ -90,7 +90,7 @@ public class CaptureView {
private final AtomicBoolean isTakingPhoto = new AtomicBoolean(false);
private final ErhaAPI erhaAPI = new ErhaAPI(true);
private final ErhaAPI erhaAPI = new ErhaAPI(config.isProduction());
// for timeout 180 detik
private final int timeout = 180;
@@ -513,13 +513,14 @@ public class CaptureView {
String[] files = prc.compressedcrop();
if (files.length>0){
InsertSQL(prc);
erhaAPI.setProduction(config.isProduction());
Task<Void> uploadtask = new Task<>() {
@Override
protected Void call() {
int totalfiles = files.length;
int counter = 0;
for (String ff : files) {
UploadHttpResult ur = erhaAPI.Upload_File(prefix, ff,true);
if (ur.getResult().message.startsWith("Record has been created")) {
counter++;
@@ -928,6 +929,7 @@ public class CaptureView {
Task<PatientRecord> checkpatientID = new Task<>() {
@Override
protected PatientRecord call() throws Exception {
erhaAPI.setProduction(config.isProduction());
BarcodeHttpResult br = erhaAPI.Validate_Barcode(finalbarCode,true);
if (br.getStatusCode()==200){
if (br.getResult().message.startsWith("Records found")){
@@ -955,7 +957,7 @@ public class CaptureView {
}
} else {
Logger.error("HTTP code ", br.getStatusCode(), " for barcode ", finalbarCode);
throw new Exception("HTTP code "+br.getStatusCode()+" untuk barcode "+finalbarCode);
throw new Exception("Barcode "+finalbarCode+" failed, code= "+br.getStatusCode()+", message: "+br.getBody());
}
}
@@ -1101,6 +1103,9 @@ public class CaptureView {
};
image.setCameraStatus("Camera Starting");
if (image.StartLiveView(lce, title, use_qr_detector, use_face_detector)){
image.getDetector().setFaceMaxSize(config.getCascadeMaxSize());
image.getDetector().setFaceMinSize(config.getCascadeMinSize());
image.getDetector().setScaleFactor(config.getCascadeScaleFactor());
MainApplication.detectorsList.put(devicenumber, image.getDetector());
Logger.info("Camera "+cameraname+" started with device number "+devicenumber);
} else image.setCameraStatus("Unable to Set Grabber");

View File

@@ -10,15 +10,15 @@ import java.util.ArrayList;
import java.util.List;
public class Detectors {
public static CascadeClassifier frontalfaceDetector;
private static CascadeClassifier eyeDetector;
private static CascadeClassifier profilefaceDetector;
public CascadeClassifier frontalfaceDetector;
private CascadeClassifier eyeDetector;
private CascadeClassifier profilefaceDetector;
private static double scaleFactor = 1.2; // revisi 09/05/2025, dari nilai 1.05
private final static int minNeighbors = 5; // revisi 09/05/2025, dari nilai 3
private final static int flags = 0;
private static Size FaceminSize;
private static Size FacemaxSize;
private double scaleFactor = 1.05; // revisi 09/05/2025, dari nilai 1.05
private final int minNeighbors = 3; // revisi 09/05/2025, dari nilai 3
private final int flags = 0;
private Size FaceminSize;
private Size FacemaxSize;
public Detectors(){
LoadFrontalFaceDetector();
@@ -27,62 +27,38 @@ public class Detectors {
LoadProfileFaceDetector();
}
// public static void LoadAllDetectors(){
//
// LoadFrontalFaceDetector();
// LoadEyeDetector();
//
// LoadProfileFaceDetector();
//
// }
private void LoadFrontalFaceDetector(){
// revisi 09/05/2025, dari filename = SomeCodes.ExtractResource("/haarcascade_frontalface_default.xml");
String filename = SomeCodes.ExtractResource("/haarcascade_frontalface_alt.xml");
if (filename!=null) {
Logger.info("Face Detector file : " + filename);
if (frontalfaceDetector==null) {
try{
frontalfaceDetector = new CascadeClassifier(filename);
Logger.info("FaceDetector loaded");
} catch (Exception e){
Logger.error("Exception on loading FaceDetector : " + e.getMessage());
}
} else Logger.info("FaceDetector already loaded");
try{
frontalfaceDetector = new CascadeClassifier(filename);
} catch (Exception e){
Logger.error("Exception on loading FaceDetector : " + e.getMessage());
}
} else Logger.error("Unable to extract face detector file");
}
private void LoadProfileFaceDetector(){
String filename = SomeCodes.ExtractResource("/haarcascade_profileface.xml");
if (filename!=null) {
Logger.info("Profile Face Detector file : " + filename);
if (profilefaceDetector==null) {
try{
profilefaceDetector = new CascadeClassifier(filename);
Logger.info("ProfileFaceDetector loaded");
} catch (Exception e){
Logger.error("Exception on loading ProfileFaceDetector : " + e.getMessage());
}
} else Logger.info("ProfileFaceDetector already loaded");
try{
profilefaceDetector = new CascadeClassifier(filename);
} catch (Exception e){
Logger.error("Exception on loading ProfileFaceDetector : " + e.getMessage());
}
} else Logger.error("Unable to extract profile face detector file");
}
private void LoadEyeDetector(){
String filename = SomeCodes.ExtractResource("/haarcascade_eye.xml");
if (filename!=null) {
Logger.info("Eye Detector file : " + filename);
if (eyeDetector==null) {
try{
try{
eyeDetector = new CascadeClassifier(filename);
Logger.info("EyeDetector loaded");
} catch (Exception e){
Logger.error("Exception on loading EyeDetector : " + e.getMessage());
}
} else Logger.info("EyeDetector already loaded");
eyeDetector = new CascadeClassifier(filename);
} catch (Exception e){
Logger.error("Exception on loading EyeDetector : " + e.getMessage());
}
} else Logger.error("Unable to extract eye detector file");
}
@@ -93,14 +69,16 @@ public class Detectors {
*/
public @NonNull List<DetectorResult> HaveFrontalFace(Mat graymat){
List<DetectorResult> result = new ArrayList<>();
//System.out.println("Detecting frontal from "+ graymat.size().width() + "x" + graymat.size().height());
RectVector faces = DetectFrontalFace(graymat);
if (faces!=null && faces.size()>0){
//System.out.println("faces size = " + faces.size());
for(Rect face : faces.get()){
RectVector eyes = DetectEye(graymat, face.width());
DetectorResult dr = new DetectorResult();
dr.setFace(face);
if (eyes!=null && eyes.size()>=2){
//System.out.println("eyes size = " + eyes.size());
if (eyes.size()>=2){
for(Rect eye : eyes.get()){
if (SomeCodes.IsInsideRect(eye, face)) {
dr.AddEye(eye);
@@ -109,7 +87,7 @@ public class Detectors {
}
result.add(dr);
}
}
} //else System.out.println("faces size = 0");
return result;
}
@@ -122,7 +100,7 @@ public class Detectors {
RectVector eyes = DetectEye(graymat, face.width());
DetectorResult dr = new DetectorResult();
dr.setFace(face);
if (eyes!=null && eyes.size()>0){
if (eyes.size()>0){
for(Rect eye : eyes.get()){
if (SomeCodes.IsInsideRect(eye, face)) dr.AddEye(eye);
}
@@ -144,11 +122,11 @@ public class Detectors {
if (FaceminSize!=null){
if (FaceminSize.width()!=value || FaceminSize.height()!=value) {
FaceminSize = new Size(value, value);
//Logger.info("FaceMinSize changed to : " + FaceminSize.width());
Logger.info("FaceMinSize changed to : " + FaceminSize.width());
}
} else {
FaceminSize = new Size(value, value);
//Logger.info("FaceMinSize created with value : " + FaceminSize.width());
Logger.info("FaceMinSize created with value : " + FaceminSize.width());
}
}
@@ -157,11 +135,11 @@ public class Detectors {
if (FacemaxSize!=null){
if (FacemaxSize.width()!=value || FacemaxSize.height()!=value) {
FacemaxSize = new Size(value, value);
//Logger.info("FaceMaxSize changed to : " + FacemaxSize.width());
Logger.info("FaceMaxSize changed to : " + FacemaxSize.width());
}
} else {
FacemaxSize = new Size(value, value);
//Logger.info("FaceMaxSize created with value : " + FacemaxSize.width());
Logger.info("FaceMaxSize created with value : " + FacemaxSize.width());
}
}
@@ -192,6 +170,7 @@ public class Detectors {
int maxwidth = (int)(facewidth*0.4);
Size minsize = new Size(minwidth, minwidth);
Size maxsize = new Size(maxwidth, maxwidth);
//System.out.println("Detecting Eye with minsize = " + minsize.width() + "x" + minsize.height() + ", maxsize = " + maxsize.width() + "x" + maxsize.height());
return Detect(graymat, eyeDetector, scaleFactor, minNeighbors, flags, minsize, maxsize);
}
@@ -211,13 +190,13 @@ public class Detectors {
} catch (Exception e) {
System.out.println("Detectors Detect Error, Message : " + e.getMessage());
}
}
} else System.out.println("graymat is smaller than minSize");
}
}
}
} else System.out.println("minSize is larger than maxSize");
} else System.out.println("minSize or maxSize is null");
} else System.out.println("graymat is null, not 1 channel, or empty");
}
} else System.out.println("detector empty");
return null;
}

View File

@@ -24,7 +24,7 @@ import static Config.SomeCodes.config;
public class MainApplication extends Application {
final String version = "10072025-PRODUCTION-1.0.3";
final String version = "18082025-PRODUCTION-1.0.6";
PhotoCleaner photoCleaner;
public static Map<Integer, Detectors> detectorsList = new HashMap<>();
@@ -75,6 +75,7 @@ public class MainApplication extends Application {
Logger.info("Application started");
System.out.println("Application version : " + version+" started");
System.out.println("Using "+(config.isProduction()?"Production":"Staging")+" API URL ");
sd.setEvent(new SecureDongleEvent() {
@Override
public void onDongleMissing() {

View File

@@ -3,10 +3,7 @@ package id.co.gtc.erhacam;
import FTP.FTPCheck;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import javafx.scene.control.*;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import org.bytedeco.javacv.VideoInputFrameGrabber;
@@ -94,6 +91,27 @@ public class SettingView {
@FXML
private TextField Cam5RightCrop;
@FXML
private RadioButton apiStaging;
@FXML
private RadioButton apiProduction;
@FXML
public void changeAPIClick(){
if (apiStaging.isSelected()){
config.setAPI(false);
config.Save();
ShowAlert(Alert.AlertType.INFORMATION, "API Change", "API Change", "API Staging is selected, API will use Staging URL");
} else if (apiProduction.isSelected()){
config.setAPI(true);
config.Save();
ShowAlert(Alert.AlertType.INFORMATION, "API Change", "API Change", "API Production is selected, API will use Production URL");
} else {
ShowAlert(Alert.AlertType.ERROR, "API Change Error", "API Change Error", "Please select API Staging or API Production");
}
}
@FXML
private void ApplyCropClick(){
// Apply crop settings for each camera
@@ -340,6 +358,8 @@ public class SettingView {
MirrorCamera.setSelected(config.isMirrorCamera());
FlipCamera.setSelected(config.isFlipCamera());
apiStaging.setSelected(!config.isProduction());
apiProduction.setSelected(config.isProduction());
TextFieldSetText(Sharpness,String.valueOf(config.getSharpnessThreshold()));
TextFieldSetText(Cam1TopCrop,String.valueOf(config.getCam1TopCrop()));

View File

@@ -16,6 +16,7 @@ module id.co.gtc.erhacam {
requires java.sql;
requires javafx.graphics;
requires java.net.http;
requires org.tinylog.impl;
opens id.co.gtc.erhacam to javafx.fxml;

View File

@@ -39,7 +39,6 @@ import java.time.LocalDateTime;
import java.util.concurrent.atomic.AtomicBoolean;
import static Config.SomeCodes.*;
import static id.co.gtc.erhacam.Detectors.frontalfaceDetector;
import static org.bytedeco.opencv.global.opencv_core.CV_8UC3;
import static org.bytedeco.opencv.global.opencv_core.mean;
import static org.bytedeco.opencv.global.opencv_imgcodecs.imwrite;
@@ -776,11 +775,11 @@ public class Cameradetail_Arducam {
* @return true if face detected, otherwise false
*/
private RectVector DetectFace(UMat graymat){
if (frontalfaceDetector!=null){
val face = new RectVector();
frontalfaceDetector.detectMultiScale(graymat, face);
return face;
}
// if (frontalfaceDetector!=null){
// val face = new RectVector();
// frontalfaceDetector.detectMultiScale(graymat, face);
// return face;
// }
return null;
}

View File

@@ -56,6 +56,7 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
@@ -168,6 +169,25 @@
<children>
<Button mnemonicParsing="false" onAction="#SharpnessApply" prefHeight="37.0" prefWidth="92.0" text="Apply" AnchorPane.bottomAnchor="2.0" AnchorPane.leftAnchor="2.0" AnchorPane.rightAnchor="2.0" AnchorPane.topAnchor="2.0" />
</children>
</AnchorPane>
<AnchorPane GridPane.rowIndex="8">
<children>
<Label text="API Type" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
<AnchorPane GridPane.columnIndex="1" GridPane.rowIndex="8">
<children>
<RadioButton fx:id="apiStaging" layoutX="14.0" layoutY="8.0" mnemonicParsing="false" text="Staging" AnchorPane.bottomAnchor="2.0" AnchorPane.leftAnchor="2.0" AnchorPane.topAnchor="2.0">
<toggleGroup>
<ToggleGroup fx:id="apiselect" />
</toggleGroup></RadioButton>
<RadioButton fx:id="apiProduction" layoutX="103.0" layoutY="11.0" mnemonicParsing="false" text="Production" toggleGroup="$apiselect" AnchorPane.bottomAnchor="2.0" AnchorPane.rightAnchor="2.0" AnchorPane.topAnchor="2.0" />
</children>
</AnchorPane>
<AnchorPane GridPane.columnIndex="2" GridPane.rowIndex="8">
<children>
<Button mnemonicParsing="false" onAction="#changeAPIClick" prefHeight="33.6" prefWidth="102.4" text="Apply" AnchorPane.bottomAnchor="2.0" AnchorPane.leftAnchor="2.0" AnchorPane.rightAnchor="2.0" AnchorPane.topAnchor="2.0" />
</children>
</AnchorPane>
</children>
</GridPane>