--- 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 1. Upload an image using the file uploader 2. 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 3. Click "Process Image" to analyze the image 4. 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: 1. Image preprocessing (grayscale conversion and blur) 2. Edge detection using Canny algorithm 3. Line detection using Hough transform 4. Bend point identification 5. Angle calculation between consecutive bends ## Local Deployment 1. Install dependencies: ```bash pip install -r requirements.txt ``` 2. Run the app: ```bash python angle_detection_app.py ``` 3. Open your browser and navigate to the URL shown in the terminal (typically http://127.0.0.1:7860) ## Hugging Face Spaces Deployment 1. 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 2. Push your code to the Space: ```bash 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 1. Build the Docker image: ```bash docker build -t angle-detection-app . ``` 2. Run the container: ```bash docker run -p 7860:7860 angle-detection-app ``` 3. Access the app at http://localhost:7860 ## Requirements - Python 3.8+ - See requirements.txt for Python package dependencies