import streamlit as st # Custom CSS for styling custom_css = """ """ # Inject the CSS into the app st.markdown(custom_css, unsafe_allow_html=True) # Page Content st.markdown("
" "An image is a visual depiction of a subject, such as a person, object, scene, or idea, created or captured through means like photography, drawing, painting, or digital tools." "
", unsafe_allow_html=True ) # Buttons col1, col2, col3 = st.columns(3) with col1: if st.button("Colour Space"): st.markdown("" "Colour spaces define how colors are represented in an image. Common spaces include RGB (Red, Green, Blue), HSV (Hue, Saturation, Value), and LAB. " "Using OpenCV, you can convert between color spaces with functions like `cv2.cvtColor()`." "
", unsafe_allow_html=True ) with col2: if st.button("Video Formation"): st.markdown("" "To create videos, you can use OpenCV's `cv2.VideoWriter` class. It allows capturing frames and saving them as a video file. " "Specify the codec, frame rate, and resolution for the output." "
", unsafe_allow_html=True ) st.markdown( "Example:
" "" "import cv2\n" "fourcc = cv2.VideoWriter_fourcc(*'XVID')\n" "out = cv2.VideoWriter('output.avi', fourcc, 20.0, (640, 480))\n" "# Capture frames and write them using out.write(frame)" "", unsafe_allow_html=True ) with col3: if st.button("Affine Methods"): st.markdown("
" "Affine transformations involve operations like scaling, rotating, and translating images. OpenCV functions like `cv2.getAffineTransform` " "and `cv2.warpAffine` are used for these tasks." "
", unsafe_allow_html=True ) st.markdown( "Example:
" "" "import cv2\n" "import numpy as np\n" "rows, cols = img.shape[:2]\n" "pts1 = np.float32([[50, 50], [200, 50], [50, 200]])\n" "pts2 = np.float32([[10, 100], [200, 50], [100, 250]])\n" "M = cv2.getAffineTransform(pts1, pts2)\n" "dst = cv2.warpAffine(img, M, (cols, rows))\n" "", unsafe_allow_html=True ) # Link to Colab st.markdown( "
" "You can view and run the code in Colab: " "Colab Notebook" "
", unsafe_allow_html=True )