commit 11/04/2025

This commit is contained in:
rdkartono
2025-04-11 14:19:39 +07:00
parent b6a3076993
commit 93b1079747
8 changed files with 457 additions and 9198 deletions

View File

@@ -227,6 +227,35 @@ public class CaptureView {
}
static class CallablePhotoResult implements Callable<PhotoResult> {
private final String directory;
private final String prefix;
private final Cameradetail image;
public CallablePhotoResult(String directory, String prefix, Cameradetail image) {
this.directory = directory;
this.prefix = prefix;
this.image = image;
}
@Override
public PhotoResult call() {
if (image!=null){
image.RemapROI(0.1, 0.3, false);
double sharpness = CalculateSharpness(image.getGrayMat());
image.setSharpness_indicator(sharpness);
PhotoResult p = image.TakePhoto(directory, prefix);
p.setSharpscore(sharpness);
if (ValidFile(p.getFullres())){
if (ValidFile(p.getCompressedfile())){
return p;
}
}
}
return null;
}
}
private void take_photo_lanjutan(String directory, String prefix){
audioPlayer.PlayFile(audio_camera_shutter, null);
Size thumbsize = new Size(160,120);
@@ -238,91 +267,11 @@ public class CaptureView {
ExecutorService executor = Executors.newFixedThreadPool(5);
Callable<PhotoResult> task1 = ()->{
if (image1!=null) {
image1.RemapROI(0.1,0.3, false);
double sharpness = CalculateSharpness(image1.getGrayMat());
image1.setSharpness_indicator(sharpness);
PhotoResult p1 = image1.TakePhoto(directory,prefix);
p1.setSharpscore(sharpness);
if (ValidFile(p1.getFullres())){
if (ValidFile(p1.getCompressedfile())){
return p1;
}
}
} else System.out.println("Image1 is null");
return null;
};
Callable<PhotoResult> task2 = ()->{
if (image2!=null) {
image2.RemapROI(0.1,0.3, false);
double sharpness = CalculateSharpness(image2.getGrayMat());
image2.setSharpness_indicator(sharpness);
PhotoResult p2 = image2.TakePhoto(directory,prefix);
p2.setSharpscore(sharpness);
if (ValidFile(p2.getFullres())){
if (ValidFile(p2.getCompressedfile())){
return p2;
}
}
} else System.out.println("Image2 is null");
return null;
};
Callable<PhotoResult> task3 = ()->{
if (image3!=null) {
image3.RemapROI(0.1,0.3, false);
double sharpness = CalculateSharpness(image3.getGrayMat());
image3.setSharpness_indicator(sharpness);
PhotoResult p3 = image3.TakePhoto(directory,prefix);
p3.setSharpscore(sharpness);
if (ValidFile(p3.getFullres())){
if (ValidFile(p3.getCompressedfile())){
return p3;
}
}
} else System.out.println("Image3 is null");
return null;
};
Callable<PhotoResult> task4 = ()->{
if (image4!=null) {
image4.RemapROI(0.1,0.3, false);
double sharpness = CalculateSharpness(image4.getGrayMat());
image4.setSharpness_indicator(sharpness);
PhotoResult p4 = image4.TakePhoto(directory,prefix);
p4.setSharpscore(sharpness);
if (ValidFile(p4.getFullres())){
if (ValidFile(p4.getCompressedfile())){
return p4;
}
}
} else System.out.println("Image4 is null");
return null;
};
Callable<PhotoResult> task5 = ()->{
if (image5!=null) {
image5.RemapROI(0.1,0.3, false);
double sharpness = CalculateSharpness(image5.getGrayMat());
image5.setSharpness_indicator(sharpness);
PhotoResult p5 = image5.TakePhoto(directory,prefix);
p5.setSharpscore(sharpness);
if (ValidFile(p5.getFullres())){
if (ValidFile(p5.getCompressedfile())){
return p5;
}
}
} else System.out.println("Image5 is null");
return null;
};
CallablePhotoResult task1 = new CallablePhotoResult(directory, prefix, image1);
CallablePhotoResult task2 = new CallablePhotoResult(directory, prefix, image2);
CallablePhotoResult task3 = new CallablePhotoResult(directory, prefix, image3);
CallablePhotoResult task4 = new CallablePhotoResult(directory, prefix, image4);
CallablePhotoResult task5 = new CallablePhotoResult(directory, prefix, image5);
PhotoResult p1 = null;
PhotoResult p2 = null;
@@ -943,7 +892,6 @@ public class CaptureView {
PatientRecord pr = checkpatientID.getValue();
if (pr!=null){
int medrecid = toInt(pr.medical_record_detail_id);
System.out.println("checkpatientID.setOnSucceeded medrecid : "+medrecid);
TextAreaSetText(medicalRecordID,""+medrecid);
TextAreaSetText(PatientName, pr.name);
@@ -1051,25 +999,22 @@ public class CaptureView {
}
private void update_status(Cameradetail image){
Platform.runLater(()-> {
String sb = "Camera Started, " +
image.getBestWidth() +
"x" +
image.getBestHeight() +
"@" +
image.getLiveFPS();
String sb = "Camera Started, " +
image.getBestWidth() +
"x" +
image.getBestHeight() +
"@" +
image.getLiveFPS();
image.setCameraStatus(sb);
});
image.setCameraStatus(sb);
}
};
Platform.runLater(()-> image.setCameraStatus("Camera Starting"));
image.setCameraStatus("Camera Starting");
if (image.StartLiveView(lce, title, use_qr_detector, use_face_detector)){
//TODO Start Live View berhasil, apa lagi yang mau dikerjakan ?
} else Platform.runLater(()->image.setCameraStatus("Unable to Set Grabber"));
} else Platform.runLater(()->image.setCameraStatus("Camera not found, please check setting"));
} else image.setCameraStatus("Unable to Set Grabber");
} else image.setCameraStatus("Camera not found, please check setting");
}
}