Hi @UjjwalG,
Thank you for your patience
It is not possible to change the color and font size of cv2 window titles. However, you can:
- Use
st.markdown
above your image to provide a title with the font family, size, and color of your choice and - Display opencv2 images within your Streamlit app via
st.image(image, channels="BGR")
Here is an example of how to do it, based on your code:
import streamlit as st
import cv2
import numpy as np
filename = "cat.png"
img = cv2.imread(filename, 1)
image = np.array([img])
original_title = '<p style="font-family:Courier; color:Blue; font-size: 20px;">Original image</p>'
st.markdown(original_title, unsafe_allow_html=True)
st.image(image, channels="BGR")
new_title = '<p style="font-family:sans-serif; color:Green; font-size: 42px;">New image</p>'
st.markdown(new_title, unsafe_allow_html=True)
st.image(image, channels="BGR")
Here’s the resulting output:
Hope this helps
Happy Streamlit-ing!
Snehan