A Python-based adaptable mask generator implemented using the Canny edge detection algorithm and Hough Line Transform, offering flexibility in capturing and highlighting intricate details within images.
The generated mask can be used as a filter for identifying Points of Interest (POI) in object detection.
- Ensure Python 3.9 environment is installed
- Prepare the image that will be used for generating the mask and update the filename accordingly
- Clone the project and change directory to the project.
git clone https://github.com/adelinewei/mask-generator.git cd mask-generator
- Create a Python virtual enviornment.
python3 -m venv .venv
- Activate created Python virtual environment.
source .venv/bin/activate
- Install dependencies.
make install
Open the mask generator.
make start
Modify the rho and theta thresholds to adjust the merging of lines by changing the values on the tracebar.
Remove an unwanted line by right-clicking.
Press m
to generate a mask based on the current settings. The generated mask will be saved in the output
directory as an image file. The default extension for the file is jpg.
Press q
to quit the mask generator.
For learning purpose, I listed down the thoughts of building this application step by step.
- Apply image blurring techniques for enhanced preprocessing.
- Utilize the Canny edge detection algorithm for accurate edge identification.
- Utilize the Hough Line Transform algorithm to detect lines in the image.
- Combine lines with similar characteristics to reduce redundancy.
- Implement adjustable trackbars to fine-tune threshold values for line merging.
- Allow users to remove unwanted lines by right-clicking.
- Implement the feature to generate masks by applying identified lines.
- Save the processed image as a .jpg file.
In progress.
Todos in the roadmap include:
- Integrate additional trackbars for dynamic threshold adjustments in Canny and Hough Line Transform algorithms
- Implement line-drawing functionality
- Implement block coloring functionality