Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.4.0
metadata
title: Angle Measurement v2
sdk: gradio
sdk_version: 4.44.1
app_file: angle_detection_app.py
colorFrom: indigo
colorTo: gray
pinned: true
Angle Detection App
This app detects bends in images and measures angles between them. It's particularly useful for analyzing geometric patterns and measuring angles in technical drawings or diagrams.
Features
- Upload images in various formats (JPEG, PNG, HEIC)
- Automatic bend detection
- Angle measurement between bends
- Adjustable parameters for fine-tuning detection
- Real-time visualization with bend points and angle measurements
Usage
- Upload an image using the file uploader
- Adjust the algorithm parameters if needed:
- Blur Kernel Size: Controls image smoothing
- Canny Thresholds: Edge detection sensitivity
- Dilation Kernel Size: Edge thickening
- Hough Threshold: Line detection sensitivity
- Line Length/Gap: Minimum line length and maximum gap between line segments
- Bend Threshold: Distance threshold for bend detection
- Click "Process Image" to analyze the image
- View the results with detected bends and measured angles
Example Images
The app includes example images to help you get started. Try them out to see how the angle detection works with different types of images.
Technical Details
The app uses OpenCV for image processing and edge detection, with the following main steps:
- Image preprocessing (grayscale conversion and blur)
- Edge detection using Canny algorithm
- Line detection using Hough transform
- Bend point identification
- Angle calculation between consecutive bends
Local Deployment
- Install dependencies:
pip install -r requirements.txt
- Run the app:
python angle_detection_app.py
- Open your browser and navigate to the URL shown in the terminal (typically http://127.0.0.1:7860)
Hugging Face Spaces Deployment
Create a new Space on Hugging Face:
- Go to https://huggingface.co/spaces
- Click "New Space"
- Choose "Gradio" as the SDK
- Give your space a name
Push your code to the Space:
git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
cd YOUR_SPACE_NAME
# Copy your files here
git add .
git commit -m "Initial commit"
git push
Docker Deployment
- Build the Docker image:
docker build -t angle-detection-app .
- Run the container:
docker run -p 7860:7860 angle-detection-app
- Access the app at http://localhost:7860
Requirements
- Python 3.8+
- See requirements.txt for Python package dependencies