Patch 04/03/2025
This commit is contained in:
@@ -6,7 +6,7 @@ AudioFile04=
|
||||
AudioFile05=null
|
||||
AudioVolumeOutput=100
|
||||
Camera_Rtsp_path=/axis-media/media.amp
|
||||
Camera_ip=192.168.10.17
|
||||
Camera_ip=172.17.195.51
|
||||
Camera_password=password
|
||||
Camera_port=80
|
||||
Camera_user=root
|
||||
|
||||
4
pom.xml
4
pom.xml
@@ -20,6 +20,8 @@
|
||||
<artifactId>javacv</artifactId>
|
||||
<version>1.5.11</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bytedeco</groupId>
|
||||
<artifactId>opencv</artifactId>
|
||||
@@ -68,9 +70,9 @@
|
||||
<groupId>org.bytedeco</groupId>
|
||||
<artifactId>cuda</artifactId>
|
||||
<version>12.6-9.5-1.5.11</version>
|
||||
<classifier>linux-arm64</classifier>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bytedeco</groupId>
|
||||
<artifactId>javacpp</artifactId>
|
||||
|
||||
@@ -37,9 +37,11 @@ public class YoloDetector {
|
||||
if (SomeCodes.ValidFile(onnxfile)){
|
||||
if (SomeCodes.ValidFile(namesfile)){
|
||||
net = Dnn.readNetFromONNX(onnxfile);
|
||||
net.setPreferableBackend(Dnn.DNN_BACKEND_OPENCV);
|
||||
net.setPreferableBackend(Dnn.DNN_BACKEND_CUDA);
|
||||
net.setPreferableTarget(Dnn.DNN_TARGET_CUDA);
|
||||
//net.setPreferableBackend(Dnn.DNN_BACKEND_OPENCV);
|
||||
//net.setPreferableBackend(Dnn.DNN_BACKEND_INFERENCE_ENGINE);
|
||||
net.setPreferableTarget(Dnn.DNN_TARGET_CPU);
|
||||
//net.setPreferableTarget(Dnn.DNN_TARGET_CPU);
|
||||
//net.setPreferableTarget(Dnn.DNN_TARGET_NPU);
|
||||
|
||||
classes = new ArrayList<>();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package Other;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.sun.jna.Platform;
|
||||
import org.bytedeco.javacpp.Loader;
|
||||
import org.bytedeco.javacv.Frame;
|
||||
import org.bytedeco.javacv.OpenCVFrameConverter;
|
||||
@@ -21,7 +22,14 @@ import java.util.Properties;
|
||||
|
||||
public class SomeCodes {
|
||||
static{
|
||||
Loader.load(opencv_java.class);
|
||||
//Loader.load(opencv_java.class);
|
||||
if (Platform.isLinux()){
|
||||
File ff = new File("/usr/local/lib/libopencv_java4100.so");
|
||||
if (ff.isFile()){
|
||||
Logger.info("Loading opencv_java 4.10.0 with cuda from /usr/local/lib");
|
||||
System.load(ff.getAbsolutePath());
|
||||
} else Logger.info("library opencv_java with cuda not found, loading standard opencv");
|
||||
} else Logger.info("Platform is not Linux, loading standard opencv");
|
||||
}
|
||||
|
||||
public final static String currentDirectory = System.getProperty("user.dir");
|
||||
|
||||
@@ -272,9 +272,11 @@ public class WebServer {
|
||||
socketIOClients.forEach((key, client) -> client.disconnect());
|
||||
socketIOClients.clear();
|
||||
socketServer.stop();
|
||||
|
||||
Logger.info("SocketIO server stopped");
|
||||
} catch (JavalinException e){
|
||||
Logger.error("Web server failed to stop: {}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Main {
|
||||
private static WebServer webServer;
|
||||
|
||||
//change parameter ini untuk menggunakan Yolo atau tidak
|
||||
private static final boolean use_Yolo = true;
|
||||
private static final boolean use_Yolo = false;
|
||||
private static RtspGrabber rtspGrabber;
|
||||
|
||||
private static PanTiltController panTiltController;
|
||||
@@ -54,22 +54,48 @@ public class Main {
|
||||
private static ExecutorService gpioExecutor = null;
|
||||
|
||||
private static PCF8574 pcf8574 = null;
|
||||
|
||||
private static final String Version = "V1.0 (04/03/2025)";
|
||||
// Application start from here
|
||||
public static void main(String[] args) {
|
||||
System.setProperty("jna.debug_load", "false");
|
||||
System.out.println("BirdStrikeSoetta "+Version);
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
if (use_multiusb_audio) {
|
||||
if (multiUSBAudioPlayer != null) multiUSBAudioPlayer.Unload();
|
||||
} else {
|
||||
if (audioPlayer != null) audioPlayer.Unload();
|
||||
if (multiUSBAudioPlayer != null) {
|
||||
multiUSBAudioPlayer.Unload();
|
||||
Logger.info("MultiUSB Audio Unloaded");
|
||||
}
|
||||
} else {
|
||||
if (audioPlayer != null) {
|
||||
audioPlayer.Unload();
|
||||
Logger.info("Audio Unloaded");
|
||||
}
|
||||
}
|
||||
if (webServer!=null) {
|
||||
webServer.Stop();
|
||||
Logger.info("Web Server stopped");
|
||||
}
|
||||
if (rtspGrabber!=null) {
|
||||
rtspGrabber.Stop();
|
||||
Logger.info("Rtsp Grabber stopped");
|
||||
}
|
||||
if (panTiltController!=null) {
|
||||
panTiltController.Close();
|
||||
Logger.info("Pan Tilt Controller closed");
|
||||
}
|
||||
if (vapixProtocol!=null) {
|
||||
vapixProtocol.Close();
|
||||
Logger.info("Vapix Protocol closed");
|
||||
}
|
||||
if (timer!=null) {
|
||||
timer.cancel();
|
||||
Logger.info("Timer cancelled");
|
||||
}
|
||||
if (gpioExecutor!=null) {
|
||||
gpioExecutor.shutdown();
|
||||
Logger.info("GPIO Executor shutdown");
|
||||
}
|
||||
if (webServer!=null) webServer.Stop();
|
||||
if (rtspGrabber!=null) rtspGrabber.Stop();
|
||||
if (panTiltController!=null) panTiltController.Close();
|
||||
if (vapixProtocol!=null) vapixProtocol.Close();
|
||||
if (timer!=null) timer.cancel();
|
||||
if (gpioExecutor!=null) gpioExecutor.shutdown();
|
||||
if (AmplifierPower!=null) {
|
||||
Logger.info("GPIO pin {} unexport : {}",AmplifierPower.pin, GPIO.UnexportPin(AmplifierPower));
|
||||
}
|
||||
@@ -87,6 +113,7 @@ public class Main {
|
||||
}
|
||||
if (pcf8574!=null){
|
||||
pcf8574.Close();
|
||||
Logger.info("PCF8574 closed");
|
||||
}
|
||||
Logger.info("Application Stopped");
|
||||
|
||||
@@ -467,15 +494,23 @@ public class Main {
|
||||
Properties config = SomeCodes.LoadProperties("config.properties");
|
||||
String targetip = config.getProperty("Camera_ip");
|
||||
String rtsppath = config.getProperty("Camera_Rtsp_path");
|
||||
Logger.info("Camera IP : "+targetip);
|
||||
Logger.info("Camera Rtsp Path : "+rtsppath);
|
||||
int width = 1920;
|
||||
int height = 1080;
|
||||
|
||||
// TODO test pakai sony camera, nanti hapus
|
||||
targetip = "172.17.195.51";
|
||||
rtsppath = "/video1";
|
||||
width = 1280;
|
||||
height = 720;
|
||||
Logger.info("Camera IP: {}, Rtsp Path: {}, Width: {}, Height: {}", targetip, rtsppath, width,height);
|
||||
|
||||
rtspGrabber = null;
|
||||
if (ValidString(targetip)){
|
||||
if (ValidString(rtsppath)){
|
||||
if (IpIsReachable(targetip)){
|
||||
Logger.info("Camera IP : "+targetip+" is reachable");
|
||||
rtspGrabber = new RtspGrabber(targetip, rtsppath, use_Yolo);
|
||||
rtspGrabber.Start(true, 1920, 1080);
|
||||
rtspGrabber.Start(true, width, height);
|
||||
} else Logger.warn("Camera IP : "+targetip+" is not reachable");
|
||||
} else Logger.warn("Camera Path : "+rtsppath+" is not valid string");
|
||||
} else Logger.warn("Camera IP : "+targetip+" is not valid string");
|
||||
|
||||
Reference in New Issue
Block a user