Commit 21032025
This commit is contained in:
@@ -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){
|
||||
if (mGrabber!=null){
|
||||
mGrabber.setOption(Videoio.CAP_PROP_SATURATION, value);
|
||||
@@ -909,16 +933,17 @@ public class Cameradetail {
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if (!originalmat.empty()) {
|
||||
opencv_imgproc.resize(originalmat, LiveMat, LiveSize); // resize to LiveSize
|
||||
if (!BestMat.empty()) {
|
||||
opencv_imgproc.resize(BestMat, LiveMat, LiveSize); // resize to LiveSize
|
||||
UMat graymat = new UMat(); // use OpenCL for grayscale
|
||||
opencv_imgproc.cvtColor(LiveMat,graymat, COLOR_BGR2GRAY); // convert to grayscale
|
||||
|
||||
if (use_qr){
|
||||
String qr = DetectQRFromMat(graymat);
|
||||
if (ValidBarCode(qr)){
|
||||
@@ -976,13 +1001,6 @@ public class Cameradetail {
|
||||
if (event!=null) event.onFrontalFaceDetector(true, _face_width, _face_height);
|
||||
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){
|
||||
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));
|
||||
@@ -1043,17 +1061,10 @@ public class Cameradetail {
|
||||
if (event!=null) event.onProfileFaceDetector(true, _face_width, _face_height);
|
||||
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 {
|
||||
// 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
|
||||
// 30 frame approximately 2 second
|
||||
eye_state = -1;
|
||||
|
||||
Reference in New Issue
Block a user