""",
unsafe_allow_html=True,
)
col1, col2 = st.columns(2)
with col1:
if st.button("Open Jupyter Notebook"):
st.session_state['jupyter_clicked'] = True
st.session_state['pdf_clicked'] = False
with col2:
if st.button("Open PDF"):
st.session_state['pdf_clicked'] = True
st.session_state['jupyter_clicked'] = False
if st.session_state['jupyter_clicked']:
st.markdown(
"""
""",
unsafe_allow_html=True,
)
# Embed the converted HTML file for the notebook
notebook_html_path = "pages/basic_img_ops.html"
with open(notebook_html_path, "r") as f:
notebook_html = f.read()
st.components.v1.html(notebook_html, height=500, scrolling=True)
elif st.session_state['pdf_clicked']:
st.markdown(
"""
""",
unsafe_allow_html=True,
)
pdf_path = "pages/basic_img_ops.pdf"
# Read the PDF file content (binary data)
with open(pdf_path, "rb") as file:
pdf_data = file.read() # This is the binary data of the PDF file
# Display the PDF in an iframe
st.markdown(
f'
',
unsafe_allow_html=True,
)
# Provide download option for the PDF file
st.download_button(
label="Download PDF",
data=pdf_data, # Provide the binary file data here
file_name="basic_img_ops.pdf", # This is the name that will appear when the user downloads the file
mime="application/pdf"
)
if st.button("Next Page: Working on the Image"):
st.session_state['page'] = 'image_working'
elif page == 'image_working':
st.markdown("
For this operation, we have to import cv2
module and use the method split()
.
The split()
method is used to separate a multi-channel image into its individual single-channel components.
For this operation, we have to import cv2
module and use the method merge()
.
The merge()
method is used to combine multiple single-channel images into a single multi-channel image.
""",
unsafe_allow_html=True,
)
col1, col2 = st.columns(2)
with col1:
if st.button("Open Jupyter Notebook"):
st.session_state['jupyter_clicked'] = True
st.session_state['pdf_clicked'] = False
with col2:
if st.button("Open PDF"):
st.session_state['pdf_clicked'] = True
st.session_state['jupyter_clicked'] = False
if st.session_state['jupyter_clicked']:
st.markdown(
"""
This Jupyter notebook explains the split and merge methods that can be performed on an image.
""",
unsafe_allow_html=True,
)
# Embed the converted HTML file for the notebook
notebook_html_path = "pages/working_on_img.html"
with open(notebook_html_path, "r") as f:
notebook_html = f.read()
st.components.v1.html(notebook_html, height=500, scrolling=True)
elif st.session_state['pdf_clicked']:
st.markdown(
"""
This PDF file explains the split and merge methods that can be performed on an image.
""",
unsafe_allow_html=True,
)
pdf_path = "pages/working_on_img.pdf"
# Read the PDF file content (binary data)
with open(pdf_path, "rb") as file:
pdf_data = file.read() # This is the binary data of the PDF file
# Display the PDF in an iframe
st.markdown(
f'
',
unsafe_allow_html=True,
)
# Provide download option for the PDF file
st.download_button(
label="Download PDF",
data=pdf_data, # Provide the binary file data here
file_name="working_on_img.pdf", # This is the name that will appear when the user downloads the file
mime="application/pdf"
)
if st.button("Next Page: Conversion between Color Spaces"):
st.session_state['page'] = 'color_space_conversion_on_img'
elif page == 'color_space_conversion_on_img':
st.markdown("
Conversion between Color Spaces
", unsafe_allow_html=True)
st.markdown(
"""
In the cv2
module, we have an in-built method called cvtColor()
along with in-built parameters for each conversion.
1) For converting BGR to Grayscale,
We use the parameter COLOR_BGR2GRAY
inside the cvtColor()
method.
2) For converting Grayscale to BGR,
We use the parameter COLOR_GRAY2BGR
inside the cvtColor()
method.
3) For converting BGR to RGB,
We use the parameter COLOR_BGR2RGB
inside the cvtColor()
method.
""",
unsafe_allow_html=True,
)
col1, col2 = st.columns(2)
with col1:
if st.button("Open Jupyter Notebook"):
st.session_state['jupyter_clicked'] = True
st.session_state['pdf_clicked'] = False
with col2:
if st.button("Open PDF"):
st.session_state['pdf_clicked'] = True
st.session_state['jupyter_clicked'] = False
if st.session_state['jupyter_clicked']:
st.markdown(
"""
This Jupyter notebook explains the split and merge methods that can be performed on an image.
""",
unsafe_allow_html=True,
)
# Embed the converted HTML file for the notebook
notebook_html_path = "pages/converting_color_spaces.html"
with open(notebook_html_path, "r") as f:
notebook_html = f.read()
st.components.v1.html(notebook_html, height=500, scrolling=True)
elif st.session_state['pdf_clicked']:
st.markdown(
"""
This PDF file explains the split and merge methods that can be performed on an image.
""",
unsafe_allow_html=True,
)
pdf_path = "pages/converting_color_spaces.pdf"
# Read the PDF file content (binary data)
with open(pdf_path, "rb") as file:
pdf_data = file.read() # This is the binary data of the PDF file
# Display the PDF in an iframe
st.markdown(
f'
',
unsafe_allow_html=True,
)
# Provide download option for the PDF file
st.download_button(
label="Download PDF",
data=pdf_data, # Provide the binary file data here
file_name="converting_color_spaces.pdf", # This is the name that will appear when the user downloads the file
mime="application/pdf"
)
if st.button("Next Page: Affine Transformations on an Image"):
st.session_state['page'] = 'affine_transformations'
elif page == 'affine_transformations':
st.markdown("
Affine Transformations on an Image
", unsafe_allow_html=True)
st.markdown(
"""
Affine Transformations are a part of Image augmentation.
Image augmentation is a technique of creating new images from the existing images.
This technique is used to create a balance in the dataset.
For a particular label, ff there are less images compared to the other label,
we increase the no. of images in that label using Image augmentation.
Advantages of Affine Transformations include:
1) We convert our imbalanced data into balanced data.
2) We get new images from old ones
There are 5 types of Affine Transformations namely:
1) Translation
2) Rotation
3) Scaling
4) Shearing
5) Cropping
It is a technique of shifting the image by some bits on the X-axis and the Y-axis.
The extra bits created are replaced with black color or duplicate pixels.
We apply a Translation matrix ( Tm ) for this.
It is a technique of rotating the image by at an angle from the specified position.
We apply a Rotation matrix ( Rm ) for this.
We can use a combination of Rotation & Translation in the same Rotation matrix ( Rm )
It is a technique of increasing or decreasing the size of the image by a particular scale.
We apply a Scaling matrix ( Sm ) for this.
We can use a combination of Scaling & Translation in the same Scaling matrix ( Sm )
It is a technique of stretching the image from its edges by a particular value.
We apply a Shearing matrix ( Shm ) for this.
We can use a combination of Shearing, Scaling & Translation in the same Shearing matrix ( Shm )
It is a technique of extracting or cutting a part of the image from the original image.
We don't have a cropping matrix for this technique.
Instead, we have to do it manually using slicing operation on the Numpy array.
""",
unsafe_allow_html=True,
)
col1, col2 = st.columns(2)
with col1:
if st.button("Open Jupyter Notebook"):
st.session_state['jupyter_clicked'] = True
st.session_state['pdf_clicked'] = False
with col2:
if st.button("Open PDF"):
st.session_state['pdf_clicked'] = True
st.session_state['jupyter_clicked'] = False
if st.session_state['jupyter_clicked']:
st.markdown(
"""
This Jupyter notebook explains all the affine transformations that can be performed on an image.
""",
unsafe_allow_html=True,
)
# Embed the converted HTML file for the notebook
notebook_html_path = "pages/affine_transformations.html"
with open(notebook_html_path, "r") as f:
notebook_html = f.read()
st.components.v1.html(notebook_html, height=500, scrolling=True)
elif st.session_state['pdf_clicked']:
st.markdown(
"""
This PDF file explains all the affine transformations that can be performed on an image.
""",
unsafe_allow_html=True,
)
pdf_path = "pages/affine_transformations.pdf"
# Read the PDF file content (binary data)
with open(pdf_path, "rb") as file:
pdf_data = file.read() # This is the binary data of the PDF file
# Display the PDF in an iframe
st.markdown(
f'
',
unsafe_allow_html=True,
)
# Provide download option for the PDF file
st.download_button(
label="Download PDF",
data=pdf_data, # Provide the binary file data here
file_name="affine_transformations.pdf", # This is the name that will appear when the user downloads the file
mime="application/pdf"
)
if st.button("Next Page: Handling Video Data"):
st.session_state['page'] = 'video_data'
elif page == 'video_data':
st.markdown("
Handling Video Data
", unsafe_allow_html=True)
st.markdown(
"""
A video is a sequence of images, called frames, displayed rapidly one after another to create the illusion of motion.
To deal with the video data, we import the cv2
module and use the VideoCapture()
method.
VideoCapture()
method is used to converts a video into list of frames.
If we specify a path inside VideoCapture()
method, it reads the particular video.
If we assign 0 inside the VideoCapture()
method, it open the Web camera for live video capturing.
""",
unsafe_allow_html=True,
)
col1, col2 = st.columns(2)
with col1:
if st.button("Open Jupyter Notebook"):
st.session_state['jupyter_clicked'] = True
st.session_state['pdf_clicked'] = False
with col2:
if st.button("Open PDF"):
st.session_state['pdf_clicked'] = True
st.session_state['jupyter_clicked'] = False
if st.session_state['jupyter_clicked']:
st.markdown(
"""
This Jupyter notebook explains how to handle video data.
""",
unsafe_allow_html=True,
)
# Embed the converted HTML file for the notebook
notebook_html_path = "pages/handling_video_data.html"
with open(notebook_html_path, "r") as f:
notebook_html = f.read()
st.components.v1.html(notebook_html, height=500, scrolling=True)
elif st.session_state['pdf_clicked']:
st.markdown(
"""
This PDF file explains how to handle video data.
""",
unsafe_allow_html=True,
)
pdf_path = "pages/handling_video_data.pdf"
# Read the PDF file content (binary data)
with open(pdf_path, "rb") as file:
pdf_data = file.read() # This is the binary data of the PDF file
# Display the PDF in an iframe
st.markdown(
f'
',
unsafe_allow_html=True,
)
# Provide download option for the PDF file
st.download_button(
label="Download PDF",
data=pdf_data, # Provide the binary file data here
file_name="handling_video_data.pdf", # This is the name that will appear when the user downloads the file
mime="application/pdf"
)
if st.button("Next Page: Interesting projects on Image & Video data"):
st.session_state['page'] = 'projects'
elif page == 'projects':
st.markdown("
🎥✨ Interesting Projects on Image & Video Data 🌟🖼️
", unsafe_allow_html=True)
st.markdown(
"""
This amazing project explains how we can convert an image into tabular data. Check this out below 👇
""",
unsafe_allow_html=True,
)
if st.button("Go to Project 1"):
js = "window.open('https://github.com/ChaitanyaSubhakar/Handling-Image-and-Video/blob/main/converting_image_into_tabular_data.ipynb')"
st.components.v1.html(f"", height=0)
st.markdown(
"""
This amazing project explains how we can convert a video into tabular data. Check this out below 👇
""",
unsafe_allow_html=True,
)
if st.button("Go to Project 2"):
js = "window.open('https://github.com/ChaitanyaSubhakar/Handling-Image-and-Video/blob/main/converting_videos_into_tabular_data.ipynb')"
st.components.v1.html(f"", height=0)
st.markdown(
"""
This amazing project explains how we can create interesting Animation videos using OpenCV package. Check this out below 👇
""",
unsafe_allow_html=True,
)
if st.button("Go to Project 3"):
js = "window.open('https://github.com/ChaitanyaSubhakar/Handling-Image-and-Video/blob/main/animation_project_opencv.ipynb')"
st.components.v1.html(f"", height=0)
st.markdown(
"""
This amazing project explains how we can create an interesting GIF using OpenCV package. Check this out below 👇
""",
unsafe_allow_html=True,
)
if st.button("Go to Project 4"):
js = "window.open('https://github.com/ChaitanyaSubhakar/Handling-Image-and-Video/blob/main/GIF_project.ipynb')"
st.components.v1.html(f"", height=0)
st.markdown(
"""
This amazing project explains how we can create an interesting GIF using OpenCV package. Check this out below 👇
""",
unsafe_allow_html=True,
)
if st.button("Go to Project 5"):
js = "window.open('https://github.com/ChaitanyaSubhakar/Handling-Image-and-Video/blob/main/cropping_tool.ipynb')"
st.components.v1.html(f"", height=0)
if st.button("Return to main page.."):
st.session_state['page'] = 'unstructured_data'