Harika22 commited on
Commit
76802d8
·
verified ·
1 Parent(s): 5274302

Update pages/7_Unstructured_data.py

Browse files
Files changed (1) hide show
  1. pages/7_Unstructured_data.py +52 -1
pages/7_Unstructured_data.py CHANGED
@@ -613,6 +613,57 @@ if file_type == "IMAGE":
613
  cv2.waitKey()
614
  cv2.destroyAllWindows()
615
  ''')
616
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
 
618
 
 
613
  cv2.waitKey()
614
  cv2.destroyAllWindows()
615
  ''')
616
+
617
+
618
+ if file_type == "VIDEO🎥":
619
+ st.title("**Video**")
620
+ st.markdown('''
621
+ - Video refers to a sequence of frames (images) captured or processed over time.
622
+ - OpenCV provides robust tools to read, process, and write videos using its VideoCapture class.
623
+ ''')
624
+ st.header('**Video Handling with OpenCV**')
625
+ st.markdown('''
626
+ In OpenCV, videos are treated as a sequence of images called frames. We can process videos using the `cv2.VideoCapture()` class, which allows you to:
627
+ - Read video files from your system.
628
+ - Capture live video from a webcam or other video input devices.
629
+ - Process each frame in the video stream individually.
630
+ ''')
631
+ st.subheader('**Reading a Video File**')
632
+ st.markdown('''
633
+ To read a video file, OpenCV uses the `cv2.VideoCapture()` function. It loads the video file and allows you to process each frame sequentially.
634
+ The following example demonstrates how to:
635
+ - Read frames from a video file.
636
+ - Display the video in a window.
637
+ ''')
638
+
639
+ st.subheader("**Key Methods in Video Capturing**")
640
+ st.markdown("""
641
+ Here are some key methods used in video capturing with OpenCV:
642
+ - **`cv2.VideoCapture()`**: Opens the video source, either a camera (index 0 for default webcam) or a video file path.
643
+ - **`read()`**: Reads frames from the video stream. It returns a boolean value and the frame (`frame`).
644
+ - **`release()`**: Releases the video capture object and closes the video stream.
645
+ - **`cv2.namedWindow()`**:It actually creates a pop-up window and all the features of pop-up window will be created
646
+ - **`cv2.imshow()`**: As it is not creating pop-up window ,it internally calls the namedWindow() where we can create our own pop-up window
647
+ - **`cv2.waitKey()`**: It internally creates a po-up window and for that window it is going to add delay
648
+
649
+ Waits for a key event for a specified amount of time (in milliseconds). It returns the ASCII value of the key pressed.
650
+
651
+ If 0 is passed, it waits indefinitely until a key is pressed.
652
+ - **`cv2.destroyAllWindows()`**: Closes all OpenCV windows that were opened during the program's execution.
653
+ - **`cv2.MouseCallBack()`**: It is a technique where we can make lot of things automated
654
+ - **`cv2.SetMouseCallBack()`**:It will be automatically activated when we hover the mouse inside pop-up window.
655
+
656
+ It is going to call user-defined function which tracks the events of mouse
657
+ - It contains 5 parameters
658
+ - **5 parameters:**
659
+ - def fun(event,x,yflags,param):
660
+ - **Event**: It is going to track all windows what event has performed inside pop-up window
661
+ - **x,y**: x,y are rows and columns
662
+ - **flags**: It is used to track an event where we can include additional features
663
+ - **param**: It is used to add additional functions
664
+
665
+ These methods are useful in forming the foundation of real-time video processing in OpenCV,
666
+ and also Essential for handling the display and closing of images in OpenCV applications.
667
+ """)
668
 
669