commit 26/05/2025
Tambah Crop Setting
This commit is contained in:
@@ -35,6 +35,7 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
@@ -67,6 +68,11 @@ public class Cameradetail {
|
|||||||
private LiveCamEvent event = null;
|
private LiveCamEvent event = null;
|
||||||
private @Getter @Setter CameraConfigEnum cameraConfigEnum = CameraConfigEnum.CameraConfigCenter;
|
private @Getter @Setter CameraConfigEnum cameraConfigEnum = CameraConfigEnum.CameraConfigCenter;
|
||||||
private @Getter int LiveFPS = 0;
|
private @Getter int LiveFPS = 0;
|
||||||
|
private double topcrop = 0.0;
|
||||||
|
private double bottomcrop = 0.0;
|
||||||
|
private double leftcrop = 0.0;
|
||||||
|
private double rightcrop = 0.0;
|
||||||
|
private String title = "";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -261,7 +267,10 @@ public class Cameradetail {
|
|||||||
public void setCameraTitle(String title){
|
public void setCameraTitle(String title){
|
||||||
|
|
||||||
if (ValidString(title)){
|
if (ValidString(title)){
|
||||||
LabelSetText(cameratitle, title,null);
|
if (!Objects.equals(this.title, title)){
|
||||||
|
this.title = title;
|
||||||
|
LabelSetText(cameratitle, title,null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -797,6 +806,18 @@ public class Cameradetail {
|
|||||||
return prefix+" "+timetag+" "+cameratitle.getText() + "_reduced" + extension;
|
return prefix+" "+timetag+" "+cameratitle.getText() + "_reduced" + extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Release(){
|
||||||
|
if (mGrabber!=null){
|
||||||
|
try{
|
||||||
|
StopLiveView();
|
||||||
|
mGrabber.release();
|
||||||
|
mGrabber = null;
|
||||||
|
} catch (Exception e){
|
||||||
|
System.out.println("Release failed, Unable to Release Camera, Error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void StopLiveView(){
|
public void StopLiveView(){
|
||||||
Capturing.set(false);
|
Capturing.set(false);
|
||||||
if (mGrabber!=null){
|
if (mGrabber!=null){
|
||||||
@@ -1151,8 +1172,39 @@ public class Cameradetail {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
public void ChangeCropValue(){
|
||||||
|
if ("01".equals(title)){
|
||||||
|
topcrop = config.getCam1TopCrop();
|
||||||
|
leftcrop = config.getCam1LeftCrop();
|
||||||
|
rightcrop = config.getCam1RightCrop();
|
||||||
|
bottomcrop = config.getCam1BottomCrop();
|
||||||
|
} else if ("02".equals(title)){
|
||||||
|
topcrop = config.getCam2TopCrop();
|
||||||
|
leftcrop = config.getCam2LeftCrop();
|
||||||
|
rightcrop = config.getCam2RightCrop();
|
||||||
|
bottomcrop = config.getCam2BottomCrop();
|
||||||
|
} else if ("03".equals(title)){
|
||||||
|
topcrop = config.getCam3TopCrop();
|
||||||
|
leftcrop = config.getCam3LeftCrop();
|
||||||
|
rightcrop = config.getCam3RightCrop();
|
||||||
|
bottomcrop = config.getCam3BottomCrop();
|
||||||
|
} else if ("04".equals(title)){
|
||||||
|
topcrop = config.getCam4TopCrop();
|
||||||
|
leftcrop = config.getCam4LeftCrop();
|
||||||
|
rightcrop = config.getCam4RightCrop();
|
||||||
|
bottomcrop = config.getCam4BottomCrop();
|
||||||
|
} else if ("05".equals(title)){
|
||||||
|
topcrop = config.getCam5TopCrop();
|
||||||
|
leftcrop = config.getCam5LeftCrop();
|
||||||
|
rightcrop = config.getCam5RightCrop();
|
||||||
|
bottomcrop = config.getCam5BottomCrop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean StartLiveView(LiveCamEvent event, String cameratitle, boolean use_qr , boolean use_face) {
|
public boolean StartLiveView(LiveCamEvent event, String cameratitle, boolean use_qr , boolean use_face) {
|
||||||
this.event = event;
|
this.event = event;
|
||||||
|
this.title = cameratitle;
|
||||||
|
ChangeCropValue();
|
||||||
if (mGrabber != null) {
|
if (mGrabber != null) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -1286,10 +1338,8 @@ public class Cameradetail {
|
|||||||
System.out.println("scaleXReduced = "+scaleXReduced+" scaleYReduced = "+scaleYReduced);
|
System.out.println("scaleXReduced = "+scaleXReduced+" scaleYReduced = "+scaleYReduced);
|
||||||
System.out.println("ReducedMatROI camera "+cameratitle.getText()+" = "+RectToString(ReducedMatROI));
|
System.out.println("ReducedMatROI camera "+cameratitle.getText()+" = "+RectToString(ReducedMatROI));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} //else System.out.println("LiveMatROI is Outside LiveMat for camera "+cameratitle.getText());
|
|
||||||
} //else System.out.println("LiveMatROI is invalid for camera "+cameratitle.getText());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -194,12 +194,6 @@ public class CaptureView {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isTakingPhoto.set(false);
|
isTakingPhoto.set(false);
|
||||||
//AutoCloseAlert.show("QR Code Not Available", "", "Please scan QR before continue", 5, s -> AutoCloseAlert.show("Scan Barcode", "Silahkan Scan Barcode Anda", "Arahkan kertas barcode ke kamera", 0, null));
|
|
||||||
// if (!Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
|
||||||
// if (AutoCloseAlert.banner_01!=null){
|
|
||||||
// AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
clear();
|
clear();
|
||||||
PlayFileWithoutEvent(audio_scan_barcode);
|
PlayFileWithoutEvent(audio_scan_barcode);
|
||||||
}
|
}
|
||||||
@@ -615,11 +609,6 @@ public class CaptureView {
|
|||||||
LoadCameraDetail(cam5, 5, CameraConfigEnum.CameraConfigRight90);
|
LoadCameraDetail(cam5, 5, CameraConfigEnum.CameraConfigRight90);
|
||||||
|
|
||||||
Platform.runLater(()->{
|
Platform.runLater(()->{
|
||||||
// if (!Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
|
||||||
// if (AutoCloseAlert.banner_01!=null){
|
|
||||||
// AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
int indexleft90=-1;
|
int indexleft90=-1;
|
||||||
@@ -1079,7 +1068,7 @@ public class CaptureView {
|
|||||||
@Override
|
@Override
|
||||||
public void onDoubleBlink(int counter) {
|
public void onDoubleBlink(int counter) {
|
||||||
if (audioPlayer!=null && audioPlayer.isPlaying()) return; // let audio finish playback
|
if (audioPlayer!=null && audioPlayer.isPlaying()) return; // let audio finish playback
|
||||||
if (isTakingPhoto.get()) return; // other camera is taking picture
|
if (isTakingPhoto.get()) return; // another camera is taking picture
|
||||||
// revisi 08/04/2025
|
// revisi 08/04/2025
|
||||||
TakePhotos();
|
TakePhotos();
|
||||||
}
|
}
|
||||||
@@ -1107,8 +1096,7 @@ public class CaptureView {
|
|||||||
};
|
};
|
||||||
image.setCameraStatus("Camera Starting");
|
image.setCameraStatus("Camera Starting");
|
||||||
if (image.StartLiveView(lce, title, use_qr_detector, use_face_detector)){
|
if (image.StartLiveView(lce, title, use_qr_detector, use_face_detector)){
|
||||||
//TODO Start Live View berhasil, apa lagi yang mau dikerjakan ?
|
Runtime.getRuntime().addShutdownHook(new Thread(image::Release));
|
||||||
|
|
||||||
} else image.setCameraStatus("Unable to Set Grabber");
|
} else image.setCameraStatus("Unable to Set Grabber");
|
||||||
} else image.setCameraStatus("Camera not found, please check setting");
|
} else image.setCameraStatus("Camera not found, please check setting");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user