Commit 21032025
This commit is contained in:
Binary file not shown.
@@ -690,7 +690,7 @@ public class ConfigFile {
|
|||||||
Detectors.setScaleFactor(cascadeScaleFactor);
|
Detectors.setScaleFactor(cascadeScaleFactor);
|
||||||
MirrorCamera = false;
|
MirrorCamera = false;
|
||||||
FlipCamera = false;
|
FlipCamera = false;
|
||||||
SharpnessThreshold = 75.0;
|
SharpnessThreshold = 300.0;
|
||||||
Logger.info("Default Config Created");
|
Logger.info("Default Config Created");
|
||||||
needsave = true;
|
needsave = true;
|
||||||
Save();
|
Save();
|
||||||
|
|||||||
@@ -244,6 +244,30 @@ public class Cameradetail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSharpness_indicator(double value){
|
||||||
|
if (value >= config.getSharpnessThreshold()){
|
||||||
|
if (Platform.isFxApplicationThread()){
|
||||||
|
sharpness_indicator.setText("OK");
|
||||||
|
sharpness_indicator.setStyle("-fx-text-fill: green; -fx-border-color: black");
|
||||||
|
} else {
|
||||||
|
Platform.runLater(()->{
|
||||||
|
sharpness_indicator.setText("OK");
|
||||||
|
sharpness_indicator.setStyle("-fx-text-fill: green; -fx-border-color: black");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Platform.isFxApplicationThread()) {
|
||||||
|
sharpness_indicator.setText("BAD");
|
||||||
|
sharpness_indicator.setStyle("-fx-text-fill: red; -fx-border-color: black");
|
||||||
|
} else {
|
||||||
|
Platform.runLater(()->{
|
||||||
|
sharpness_indicator.setText("BAD");
|
||||||
|
sharpness_indicator.setStyle("-fx-text-fill: red; -fx-border-color: black");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setSaturation(double value){
|
public void setSaturation(double value){
|
||||||
if (mGrabber!=null){
|
if (mGrabber!=null){
|
||||||
mGrabber.setOption(Videoio.CAP_PROP_SATURATION, value);
|
mGrabber.setOption(Videoio.CAP_PROP_SATURATION, value);
|
||||||
@@ -909,16 +933,17 @@ public class Cameradetail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rotate 90 degree counter clockwise karena kamera potrait
|
// rotate 90 degree counter clockwise karena kamera potrait
|
||||||
opencv_core.rotate(originalmat, originalmat, opencv_core.ROTATE_90_COUNTERCLOCKWISE);
|
opencv_core.rotate(originalmat, BestMat, opencv_core.ROTATE_90_COUNTERCLOCKWISE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IsGrabbingLiveView.set(false);
|
IsGrabbingLiveView.set(false);
|
||||||
|
|
||||||
if (!originalmat.empty()) {
|
if (!BestMat.empty()) {
|
||||||
opencv_imgproc.resize(originalmat, LiveMat, LiveSize); // resize to LiveSize
|
opencv_imgproc.resize(BestMat, LiveMat, LiveSize); // resize to LiveSize
|
||||||
UMat graymat = new UMat(); // use OpenCL for grayscale
|
UMat graymat = new UMat(); // use OpenCL for grayscale
|
||||||
opencv_imgproc.cvtColor(LiveMat,graymat, COLOR_BGR2GRAY); // convert to grayscale
|
opencv_imgproc.cvtColor(LiveMat,graymat, COLOR_BGR2GRAY); // convert to grayscale
|
||||||
|
|
||||||
if (use_qr){
|
if (use_qr){
|
||||||
String qr = DetectQRFromMat(graymat);
|
String qr = DetectQRFromMat(graymat);
|
||||||
if (ValidBarCode(qr)){
|
if (ValidBarCode(qr)){
|
||||||
@@ -976,13 +1001,6 @@ public class Cameradetail {
|
|||||||
if (event!=null) event.onFrontalFaceDetector(true, _face_width, _face_height);
|
if (event!=null) event.onFrontalFaceDetector(true, _face_width, _face_height);
|
||||||
face_indicator.setVisible(true);
|
face_indicator.setVisible(true);
|
||||||
|
|
||||||
double sharpness = CalculateSharpness(originalmat);
|
|
||||||
if (sharpness>=config.getSharpnessThreshold()){
|
|
||||||
sharpness_value = sharpness;
|
|
||||||
originalmat.copyTo(BestMat);
|
|
||||||
Platform.runLater(()->sharpness_indicator.setText(String.format("%.2f", sharpness_value)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theface.getFace()!=null){
|
if (theface.getFace()!=null){
|
||||||
LiveMatROI = new Rect(theface.getFace().x(), theface.getFace().y(), theface.getFace().width(), theface.getFace().height());
|
LiveMatROI = new Rect(theface.getFace().x(), theface.getFace().y(), theface.getFace().width(), theface.getFace().height());
|
||||||
//System.out.println("Frontal Face Detected from camera "+cameratitle+" "+RectToString(LiveMatROI));
|
//System.out.println("Frontal Face Detected from camera "+cameratitle+" "+RectToString(LiveMatROI));
|
||||||
@@ -1043,17 +1061,10 @@ public class Cameradetail {
|
|||||||
if (event!=null) event.onProfileFaceDetector(true, _face_width, _face_height);
|
if (event!=null) event.onProfileFaceDetector(true, _face_width, _face_height);
|
||||||
face_indicator.setVisible(true);
|
face_indicator.setVisible(true);
|
||||||
|
|
||||||
double sharpness = CalculateSharpness(originalmat);
|
|
||||||
if (sharpness>=config.getSharpnessThreshold()){
|
|
||||||
sharpness_value = sharpness;
|
|
||||||
originalmat.copyTo(BestMat);
|
|
||||||
Platform.runLater(()->sharpness_indicator.setText(String.format("%.2f", sharpness_value)));
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// no face detected, but let's not cancel the previous state immediately
|
// no face detected, but let's not cancel the previous state immediately
|
||||||
|
|
||||||
if (no_face_counter>30){
|
if (no_face_counter>90){
|
||||||
// kalau tidak ada face selama 30 frame, reset state
|
// kalau tidak ada face selama 30 frame, reset state
|
||||||
// 30 frame approximately 2 second
|
// 30 frame approximately 2 second
|
||||||
eye_state = -1;
|
eye_state = -1;
|
||||||
|
|||||||
@@ -160,8 +160,7 @@ public class CaptureView {
|
|||||||
image1.RemapROI(0.1,0.3, false);
|
image1.RemapROI(0.1,0.3, false);
|
||||||
|
|
||||||
double sharpness = CalculateSharpness(image1.getLiveMat());
|
double sharpness = CalculateSharpness(image1.getLiveMat());
|
||||||
System.out.println("Image1 sharpness: "+sharpness);
|
image1.setSharpness_indicator(sharpness);
|
||||||
|
|
||||||
PhotoResult p1 = image1.TakePhoto(directory,prefix);
|
PhotoResult p1 = image1.TakePhoto(directory,prefix);
|
||||||
p1.setSharpscore(sharpness);
|
p1.setSharpscore(sharpness);
|
||||||
if (ValidFile(p1.getFullres())){
|
if (ValidFile(p1.getFullres())){
|
||||||
@@ -176,8 +175,7 @@ public class CaptureView {
|
|||||||
if (image2!=null) {
|
if (image2!=null) {
|
||||||
image2.RemapROI(0.1,0.3, false);
|
image2.RemapROI(0.1,0.3, false);
|
||||||
double sharpness = CalculateSharpness(image2.getLiveMat());
|
double sharpness = CalculateSharpness(image2.getLiveMat());
|
||||||
System.out.println("Image2 sharpness: "+sharpness);
|
image2.setSharpness_indicator(sharpness);
|
||||||
|
|
||||||
PhotoResult p2 = image2.TakePhoto(directory,prefix);
|
PhotoResult p2 = image2.TakePhoto(directory,prefix);
|
||||||
p2.setSharpscore(sharpness);
|
p2.setSharpscore(sharpness);
|
||||||
if (ValidFile(p2.getFullres())){
|
if (ValidFile(p2.getFullres())){
|
||||||
@@ -193,8 +191,7 @@ public class CaptureView {
|
|||||||
if (image3!=null) {
|
if (image3!=null) {
|
||||||
image3.RemapROI(0.1,0.3, false);
|
image3.RemapROI(0.1,0.3, false);
|
||||||
double sharpness = CalculateSharpness(image3.getLiveMat());
|
double sharpness = CalculateSharpness(image3.getLiveMat());
|
||||||
System.out.println("Image3 sharpness: "+sharpness);
|
image3.setSharpness_indicator(sharpness);
|
||||||
|
|
||||||
PhotoResult p3 = image3.TakePhoto(directory,prefix);
|
PhotoResult p3 = image3.TakePhoto(directory,prefix);
|
||||||
p3.setSharpscore(sharpness);
|
p3.setSharpscore(sharpness);
|
||||||
|
|
||||||
@@ -212,8 +209,7 @@ public class CaptureView {
|
|||||||
if (image4!=null) {
|
if (image4!=null) {
|
||||||
image4.RemapROI(0.1,0.3, false);
|
image4.RemapROI(0.1,0.3, false);
|
||||||
double sharpness = CalculateSharpness(image4.getLiveMat());
|
double sharpness = CalculateSharpness(image4.getLiveMat());
|
||||||
System.out.println("Image4 sharpness: "+sharpness);
|
image4.setSharpness_indicator(sharpness);
|
||||||
|
|
||||||
PhotoResult p4 = image4.TakePhoto(directory,prefix);
|
PhotoResult p4 = image4.TakePhoto(directory,prefix);
|
||||||
p4.setSharpscore(sharpness);
|
p4.setSharpscore(sharpness);
|
||||||
|
|
||||||
@@ -231,8 +227,7 @@ public class CaptureView {
|
|||||||
if (image5!=null) {
|
if (image5!=null) {
|
||||||
image5.RemapROI(0.1,0.3, false);
|
image5.RemapROI(0.1,0.3, false);
|
||||||
double sharpness = CalculateSharpness(image5.getLiveMat());
|
double sharpness = CalculateSharpness(image5.getLiveMat());
|
||||||
System.out.println("Image5 sharpness: "+sharpness);
|
image5.setSharpness_indicator(sharpness);
|
||||||
|
|
||||||
PhotoResult p5 = image5.TakePhoto(directory,prefix);
|
PhotoResult p5 = image5.TakePhoto(directory,prefix);
|
||||||
p5.setSharpscore(sharpness);
|
p5.setSharpscore(sharpness);
|
||||||
|
|
||||||
@@ -294,7 +289,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()){
|
||||||
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";
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class MainApplication extends Application {
|
|||||||
Screen screen = Screen.getPrimary();
|
Screen screen = Screen.getPrimary();
|
||||||
Rectangle2D screenbound = screen.getVisualBounds();
|
Rectangle2D screenbound = screen.getVisualBounds();
|
||||||
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 24032025");
|
stage.setTitle("MultiCam Capture App for ERHA 25032025-007");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setResizable(true);
|
stage.setResizable(true);
|
||||||
stage.setMaximized(true);
|
stage.setMaximized(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user