commit 26/05/2025

Tambah Crop Setting
This commit is contained in:
2025-05-26 15:05:02 +07:00
parent 9effe8a7a9
commit 9e69714ae1
2 changed files with 57 additions and 19 deletions

View File

@@ -35,6 +35,7 @@ import java.awt.image.BufferedImage;
import java.nio.file.Path;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.CountDownLatch;
@@ -67,6 +68,11 @@ public class Cameradetail {
private LiveCamEvent event = null;
private @Getter @Setter CameraConfigEnum cameraConfigEnum = CameraConfigEnum.CameraConfigCenter;
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){
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;
}
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(){
Capturing.set(false);
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) {
this.event = event;
this.title = cameratitle;
ChangeCropValue();
if (mGrabber != null) {
try {
@@ -1286,10 +1338,8 @@ public class Cameradetail {
System.out.println("scaleXReduced = "+scaleXReduced+" scaleYReduced = "+scaleYReduced);
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());
}
}
}