Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
import streamlit as st
|
2 |
import cv2
|
3 |
import numpy as np
|
|
|
4 |
def main():
|
5 |
-
st.title("
|
6 |
st.sidebar.title("Upload Files")
|
7 |
|
8 |
uploaded_image = st.sidebar.file_uploader("Upload an image (PNG or JPG)", type=["png", "jpg"])
|
@@ -10,8 +11,8 @@ def main():
|
|
10 |
|
11 |
if uploaded_image and uploaded_video:
|
12 |
st.sidebar.success("Files successfully uploaded!")
|
13 |
-
image = cv2.imdecode(np.
|
14 |
-
video = cv2.VideoCapture(uploaded_video)
|
15 |
|
16 |
st.header("Uploaded Image")
|
17 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
@@ -29,7 +30,7 @@ def main():
|
|
29 |
occurrence_duration = 0
|
30 |
prev_matches = []
|
31 |
|
32 |
-
while
|
33 |
ret, frame = video.read()
|
34 |
if not ret:
|
35 |
st.write("End of video reached.")
|
|
|
1 |
import streamlit as st
|
2 |
import cv2
|
3 |
import numpy as np
|
4 |
+
|
5 |
def main():
|
6 |
+
st.title("SIFT Object Tracking in Video")
|
7 |
st.sidebar.title("Upload Files")
|
8 |
|
9 |
uploaded_image = st.sidebar.file_uploader("Upload an image (PNG or JPG)", type=["png", "jpg"])
|
|
|
11 |
|
12 |
if uploaded_image and uploaded_video:
|
13 |
st.sidebar.success("Files successfully uploaded!")
|
14 |
+
image = cv2.imdecode(np.frombuffer(uploaded_image.read(), np.uint8), cv2.IMREAD_COLOR)
|
15 |
+
video = cv2.VideoCapture(np.frombuffer(uploaded_video.read(), np.uint8))
|
16 |
|
17 |
st.header("Uploaded Image")
|
18 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
|
|
30 |
occurrence_duration = 0
|
31 |
prev_matches = []
|
32 |
|
33 |
+
while True:
|
34 |
ret, frame = video.read()
|
35 |
if not ret:
|
36 |
st.write("End of video reached.")
|