A Java-based interactive tool for selecting and extracting regions from images with multiple selection methods.
This application implements different selection algorithms to create precise selections in images:
- Point-to-Point Selection: Simple straight-line connection between selected points
- Intelligent Scissors: Edge-aware selection that finds optimal paths along image boundaries
CrossGradMono
: Grayscale gradient analysis for edge detectionColorWeight
: Enhanced color-based edge detection for similarly bright but differently colored regions
- Abstract
SelectionModel
defining selection state management and interactions PointToPointSelectionModel
for straight-line selectionsScissorsSelectionModel
for edge-following selections
- Image pixels represented as graph vertices with weighted edges
- Dijkstra's algorithm implementation for optimal path detection
- Custom
HeapMinQueue
priority queue implementation using binary heap + hash table - Asynchronous path computation with progress reporting
ImagePanel
: Main component for displaying images and handling selection overlaySelectionComponent
: Interactive overlay for selection interactionsSelectorApp
: Main application class managing UI components and user interactions
|-- graph/
| |-- Edge.java # Interface for directed edges in a graph
| |-- Graph.java # Interface for directed graph structure
| |-- HeapMinQueue.java # Efficient priority queue implementation
| |-- MinQueue.java # Priority queue interface
| |-- PathfindingSnapshot.java # Captures state of pathfinding progress
| |-- RefMinQueue.java # Reference priority queue implementation
| |-- ShortestPaths.java # Dijkstra's algorithm implementation
| |-- Vertex.java # Interface for graph vertices
| |-- Weigher.java # Interface for edge weight functions
|-- scissors/
| |-- ImageGraph.java # Graph representation of image pixels
| |-- ImagePathsSnapshot.java # Visualization of pathfinding progress
| |-- PolyLineBuffer.java # Utility for building polylines
| |-- ScissorsSelectionModel.java # Intelligent selection implementation
| |-- ScissorsWeights.java # Edge weight functions for image features
|-- selector/
| |-- ImagePanel.java # Component for displaying the image
| |-- PointToPointSelectionModel.java # Simple line segment selection
| |-- PolyLine.java # Immutable path of line segments
| |-- SelectionComponent.java # Overlay for selection interaction
| |-- SelectionModel.java # Abstract selection model
| |-- SelectorApp.java # Main application class
- Concurrent processing using SwingWorker for non-blocking UI
- Property change propagation for model-view communication
- Binary heap + hash table data structure for O(log n) priority queue operations
- Visual feedback during pathfinding with frontier/settled pixel visualization
- Interactive control point manipulation for selection refinement
- Image processing using Java's BufferedImage and Raster APIs
- Java 17 or higher
- Swing-compatible environment
- The intelligent scissors implementation is based on graph algorithms with image gradient analysis
- Edge weights are calculated using perpendicular gradient analysis at pixel boundaries
- Binary heap with hash table indexing enables efficient priority updates for Dijkstra's algorithm
- Background thread processing with progress reporting for responsive UI
- Custom polygon extraction with alpha channel for saving selections