Commit
·
783d9f8
1
Parent(s):
67216ee
rid of video after Done is clicked
Browse files- captured_image.jpg +0 -0
- captured_image_1.jpg +0 -0
- captured_images/captured_image_1.jpg +0 -0
- captured_images/captured_image_10.jpg +0 -0
- captured_images/captured_image_11.jpg +0 -0
- captured_images/captured_image_12.jpg +0 -0
- captured_images/captured_image_13.jpg +0 -0
- captured_images/captured_image_2.jpg +0 -0
- captured_images/captured_image_3.jpg +0 -0
- captured_images/captured_image_4.jpg +0 -0
- captured_images/captured_image_5.jpg +0 -0
- captured_images/captured_image_6.jpg +0 -0
- captured_images/captured_image_7.jpg +0 -0
- captured_images/captured_image_8.jpg +0 -0
- captured_images/captured_image_9.jpg +0 -0
- index.py +26 -26
captured_image.jpg
DELETED
|
Binary file (77.4 kB)
|
|
|
captured_image_1.jpg
DELETED
|
Binary file (98.8 kB)
|
|
|
captured_images/captured_image_1.jpg
DELETED
|
Binary file (93.7 kB)
|
|
|
captured_images/captured_image_10.jpg
DELETED
|
Binary file (93.9 kB)
|
|
|
captured_images/captured_image_11.jpg
DELETED
|
Binary file (81.7 kB)
|
|
|
captured_images/captured_image_12.jpg
DELETED
|
Binary file (81.5 kB)
|
|
|
captured_images/captured_image_13.jpg
DELETED
|
Binary file (84 kB)
|
|
|
captured_images/captured_image_2.jpg
DELETED
|
Binary file (94.3 kB)
|
|
|
captured_images/captured_image_3.jpg
DELETED
|
Binary file (94.4 kB)
|
|
|
captured_images/captured_image_4.jpg
DELETED
|
Binary file (94.3 kB)
|
|
|
captured_images/captured_image_5.jpg
DELETED
|
Binary file (94.9 kB)
|
|
|
captured_images/captured_image_6.jpg
DELETED
|
Binary file (94.9 kB)
|
|
|
captured_images/captured_image_7.jpg
DELETED
|
Binary file (88.8 kB)
|
|
|
captured_images/captured_image_8.jpg
DELETED
|
Binary file (94.3 kB)
|
|
|
captured_images/captured_image_9.jpg
DELETED
|
Binary file (93.4 kB)
|
|
|
index.py
CHANGED
|
@@ -7,7 +7,7 @@ if not os.path.exists("captured_images"):
|
|
| 7 |
os.makedirs("captured_images")
|
| 8 |
|
| 9 |
def main():
|
| 10 |
-
st.title('
|
| 11 |
|
| 12 |
st.sidebar.header('Ingredients & Nutrition')
|
| 13 |
|
|
@@ -21,39 +21,39 @@ def main():
|
|
| 21 |
if button_clicked:
|
| 22 |
displayRecipes()
|
| 23 |
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
|
|
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
st.error("Error: Unable to access the webcam.")
|
| 35 |
-
return
|
| 36 |
-
|
| 37 |
-
# Display a placeholder for the video stream
|
| 38 |
-
video_placeholder = st.empty()
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
|
| 58 |
def displayRecipes():
|
| 59 |
items = [
|
|
|
|
| 7 |
os.makedirs("captured_images")
|
| 8 |
|
| 9 |
def main():
|
| 10 |
+
st.title('NouriScan')
|
| 11 |
|
| 12 |
st.sidebar.header('Ingredients & Nutrition')
|
| 13 |
|
|
|
|
| 21 |
if button_clicked:
|
| 22 |
displayRecipes()
|
| 23 |
|
| 24 |
+
if not button_clicked:
|
| 25 |
+
# Create a VideoCapture object to access the webcam
|
| 26 |
+
cap = cv2.VideoCapture(0)
|
| 27 |
|
| 28 |
+
# Set the video frame width and height (optional)
|
| 29 |
+
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
|
| 30 |
+
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
|
| 31 |
|
| 32 |
+
# Check if the webcam is opened correctly
|
| 33 |
+
if not cap.isOpened():
|
| 34 |
+
st.error("Error: Unable to access the webcam.")
|
| 35 |
+
return
|
| 36 |
|
| 37 |
+
# Display a placeholder for the video stream
|
| 38 |
+
video_placeholder = st.empty()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
# Button to capture image
|
| 41 |
+
if st.button("Capture Image"):
|
| 42 |
+
capture_image(cap)
|
| 43 |
|
| 44 |
+
while True:
|
| 45 |
+
# Read a frame from the webcam
|
| 46 |
+
ret, frame = cap.read()
|
| 47 |
|
| 48 |
+
if not ret:
|
| 49 |
+
st.error("Error: Unable to read frame from the webcam.")
|
| 50 |
+
break
|
| 51 |
|
| 52 |
+
# Display the frame in the Streamlit app
|
| 53 |
+
video_placeholder.image(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB), channels="RGB", use_column_width=True)
|
| 54 |
|
| 55 |
+
# Release the VideoCapture and close the OpenCV window
|
| 56 |
+
cap.release()
|
| 57 |
|
| 58 |
def displayRecipes():
|
| 59 |
items = [
|