FUCKING SHIT RENDERS!!!!!!!!!! THE OBJECT DETECTION WORKSSS!!!
This commit is contained in:
@@ -48,7 +48,6 @@ public class CameraApp extends JFrame {
|
|||||||
private List<String> outputLayers;
|
private List<String> outputLayers;
|
||||||
private boolean detectionEnabled = true;
|
private boolean detectionEnabled = true;
|
||||||
private boolean modelLoaded = false;
|
private boolean modelLoaded = false;
|
||||||
private final int frameCount = 0;
|
|
||||||
private long lastFpsUpdate = System.currentTimeMillis();
|
private long lastFpsUpdate = System.currentTimeMillis();
|
||||||
|
|
||||||
public CameraApp() {
|
public CameraApp() {
|
||||||
@@ -396,18 +395,7 @@ public class CameraApp extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void downloadFile(String urlString, String fileName, DownloadProgressBar progressDialog) throws IOException {
|
private void downloadFile(String urlString, String fileName, DownloadProgressBar progressDialog) throws IOException {
|
||||||
URL url = new URL(urlString);
|
final HttpURLConnection connection = getHttpURLConnection(urlString);
|
||||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
|
||||||
connection.setRequestProperty("User-Agent", "Mozilla/5.0");
|
|
||||||
|
|
||||||
// Handle redirects
|
|
||||||
int status = connection.getResponseCode();
|
|
||||||
if (status == HttpURLConnection.HTTP_MOVED_TEMP ||
|
|
||||||
status == HttpURLConnection.HTTP_MOVED_PERM ||
|
|
||||||
status == HttpURLConnection.HTTP_SEE_OTHER) {
|
|
||||||
String newUrl = connection.getHeaderField("Location");
|
|
||||||
connection = (HttpURLConnection) new URL(newUrl).openConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
int totalSize = connection.getContentLength();
|
int totalSize = connection.getContentLength();
|
||||||
|
|
||||||
@@ -432,6 +420,22 @@ public class CameraApp extends JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static HttpURLConnection getHttpURLConnection(String urlString) throws IOException {
|
||||||
|
URL url = new URL(urlString);
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
|
connection.setRequestProperty("User-Agent", "Mozilla/5.0");
|
||||||
|
|
||||||
|
// Handle redirects
|
||||||
|
int status = connection.getResponseCode();
|
||||||
|
if (status == HttpURLConnection.HTTP_MOVED_TEMP ||
|
||||||
|
status == HttpURLConnection.HTTP_MOVED_PERM ||
|
||||||
|
status == HttpURLConnection.HTTP_SEE_OTHER) {
|
||||||
|
String newUrl = connection.getHeaderField("Location");
|
||||||
|
connection = (HttpURLConnection) new URL(newUrl).openConnection();
|
||||||
|
}
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateFrame() {
|
private void updateFrame() {
|
||||||
if (cap == null || !cap.isOpened()) {
|
if (cap == null || !cap.isOpened()) {
|
||||||
return;
|
return;
|
||||||
@@ -468,9 +472,6 @@ public class CameraApp extends JFrame {
|
|||||||
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
BufferedImage bufferedImage = matToBufferedImage(frame);
|
BufferedImage bufferedImage = matToBufferedImage(frame);
|
||||||
if (bufferedImage == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageIcon imageIcon = new ImageIcon(bufferedImage);
|
ImageIcon imageIcon = new ImageIcon(bufferedImage);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user