This challenge tests your ability to implement shape detection algorithms that can identify and classify the geometric shapes in images:
- Node.js (version 16 or higher)
- npm or yarn package manager
# Install dependencies
npm install
# Start development server
npm run devshape-detector/
├── src/
│ ├── main.ts # Main application code (implement here)
│ └── style.css # Basic styling
├── test-images/ # Test images directory
├── expected_results.json # Expected detection results
├── index.html # Application UI
└── README.md # This file
Implement the detectShapes() method in the ShapeDetector class located in src/main.ts. This method should:
- Analyze the provided
ImageDataobject - Detect all geometric shapes present in the image
- Classify each shape into one of the five required categories
- Return detection results with specified format
// File: src/main.ts
async detectShapes(imageData: ImageData): Promise<DetectionResult> {
// TODO: Implement your shape detection algorithm here
// This is where you write your code
}The test-images/ directory contains 10 test images with varying complexity:
- Simple shapes - Clean, isolated geometric shapes
- Mixed scenes - Multiple shapes in single image
- Complex scenarios - Overlapping shapes, noise, rotated shapes
- Edge cases - Very small shapes, partial occlusion
- Negative cases - Images with no detectable shapes
See expected_results.json for detailed expected outcomes for each test image.
Your implementation will be assessed on:
- Correctly identifying all shapes present in test images
- Minimizing false positives (detecting shapes that aren't there)
- Handling various shape sizes, orientations, and positions
- Correctly classifying detected shapes into the right categories
- Distinguishing between similar shapes (e.g., square vs. rectangle)
- Handling edge cases and ambiguous shapes
- Bounding Box Accuracy: IoU > 0.7 with expected bounding boxes
- Center Point Accuracy: < 10 pixels distance from expected centers
- Area Calculation: < 15% error from expected area values
- Confidence Calibration: Confidence scores should reflect actual accuracy
- Clean, readable, well-documented code
- Efficient algorithms (< 2000ms processing time per image)
- Proper error handling |
- Computer vision algorithms (edge detection, contour analysis)
- Mathematical shape analysis (geometric properties, ratios)
- Pattern recognition techniques
- Image processing operations
- Any algorithm you can implement from scratch
- No external computer vision libraries (OpenCV, etc.)
- Use only browser-native APIs and basic math operations
- No pre-trained machine learning models
- Work with the provided
ImageDataobject format
- Use the web interface to upload and test images
- Compare your results with
expected_results.json - Test with the provided test images
- Verify detection accuracy and confidence scores
- Check processing time performance
Your final submission should include:
- Completed implementation in
src/main.ts - Any additional helper functions or classes you created
- Brief documentation of your approach (comments in code)
- Test results or performance notes (optional)