A multhreaded PyQt UI built to allow for easy implementation of OpenCV and other CV libraries by displaying filters/processes visually with easy tuning of parameters. Built as part of research for Dr.Fan at University of Texas.
The processing of frames works in the following order:
- Filtering: performing image transformations and manipulations to obtain desired objects of interest
- Processing: performing image operations to obtain data after it has been filtered
- Annotations: drawing overlays onto frame to help visualize what is being done by the operations
The purpose of each file is as follows:
Program
main.py
: The UI container for displaying views and handling signals from display elements.- 'video_thread.py': Image operations such as the analysis and annotations are performed on separate thread
main_params.py
: The main parameter tree where child parameter objects called and stored.analysis_params.py
: Contains the template Analysis object for image operations.filter_params.py
: Holds the parameters for each of the filter objects as well as the filter operations.filter.py
: Holds the all the image filtering operations (OBSOLETE, just put the image operations inside the filter_params.py rather than creating new functions).plotter.py
: Not used, ignore.
The files below are for custom analysis using the above framework.
Tracking Analysis
tracking_analysis.py
: Holds the parameters used for analyzing distinct bubble positions over time.bubble_helpers.py
: Helper functions and objects used by the tracking analysis- Click Here for explanation of the analysis
Lifetime Analysis
lifetime_analysis.py
: Holds the parameters used for analyzing the initial position and lifetime of bubbles close to each other- Click Here for explanation of the analysis
Install Python 3.8 or higher
Use the package manager pip to install necessary packages once this repository has been cloned.
pip install git+git://github.com/pyqtgraph/pyqtgraph.git@master
pip install PyQt5
pip install pandas
pip install imutils
pip install opencv-python
pip install scipy
pip install scikit-image
pip install dataclasses
pip install matplotlib
(Note: pip install pyqtgraph
will NOT download the proper pyqtgraph version to run this software. Make sure to follow installation using git
as shown above. This will get the latest version of pyqtgraph from the source.)
- Click the file select button to open a file explorer and choose the desired image to analyze
- Click
Select ROI
to choose the region of interest. A new window will pop up, and use the mouse and cursor to select the region. Press Enter or Space to confirm, or click c or esc to cancel. - To isolate desired elements of interest, click
Add
dropdown in the Filter parameter group to add a filter. Description of filters below. Stack filters as necessary - Right click on the filter names to move them up or down (the filter operation works top down, so order matters) or to delete any filter.
- To analyze, click on the
Add
dropdown in the Analyze parameter group to add a processing operation. The operations here does not stack, meaning they will all work off of the last filtered image. However, their image annoatations will stack on top of each other. Description or processes below.
Threshold
: Converts colors above threshold to white and black otherwise.thresh
: Normal thresholdinv thresh
: Inverts the result of the thresholdotsu
: Automatic threshold
Watershed
: In development, could be used to solve merging issue with bubbles being too close to each other
Yes
PyQtGraph Documentation
PyQtGraph Website
https://pretagteam.com/question/find-contours-after-watershed-opencv
Note: Documentation doesn't cover everything, I had to look in the codebase to understand how to utilize certain functions