Original author: Jan Korytář
This Streamlit demo showcases kernel computation using sliders for customization and visualization.
The following libraries are imported:
streamlit
asst
pandas
aspd
numpy
asnp
correlate2d
fromscipy.signal
- Kernel Customization: Users can adjust kernel dimensions using a slider in the sidebar.
- If the kernel is not initialized or dimensions change, a random kernel with specified dimensions is created.
- The kernel is displayed in a data editor for user interaction.
- Title: "Simple kernel computation demo"
- Kernel Settings Sidebar: Users can set array width, height, and indices using sliders.
- Instructions: Users are prompted to select the upper-left corner of the kernel.
- The DataFrame displays array data with highlighted user-selected area.
- DataFrame Display:
- Columns and rows are highlighted based on user-selected indices.
- Output Display:
- Three columns are displayed:
- Chosen Area: User-selected array area
- Kernel Data: Kernel displayed in the data editor
- Combined Operation: Multiplication of chosen area and kernel, showing results
- Three columns are displayed:
- Convolution: Utilizes
correlate2d
fromscipy.signal
to compute convolution result. - Convolution result is displayed in a DataFrame.