Contour detection implemented with pure C#. Extract outer shapes and holes from textures. No external dependencies.Image Contours is a pure C# implementation of the Suzuki-Abe border following algorithm for Unity. It analyzes images and extracts outer contours and inner holes.This package helps when you need to programmatically understand image shapes—whether you're highlighting shape outlines, creating editing tools, or building systems that need to work with image boundaries.What makes it special:100% C# implementation - No native plugins, works on any Unity platform (Windows, Mac, Linux, iOS, Android, WebGL, consoles)Hierarchical contour detection - Automatically identifies holes and parent-child relationshipsFlexible pixel classification - Use built-in alpha threshold detection or provide your own predicate to define what counts as foregroundConnectivity options - Choose between 4-connected or 8-connected pixel neighborhoodsProduction-ready - Extensively tested with comprehensive unit test coverageEasy integration - Clean API that's easy to understand and extend for your specific needsTypical Use Cases:Detect texture outlines for highlighting or selection systemsBuild tools that need to know where pixels are in a spriteExtract boundaries for pathfinding or AI systemsWhat's Included:Core contour detection implementationTwo visualization examples: LineRenderer-based and pixel-based drawingOne sample scene demonstrating different parameter configurationsFull source code with detailed comments and XML documentationUnit test suite for validationThe package includes example components that show how to visualize detected contours. All code is documented and designed to be easy to understand and extend for your specific needs.Core Features:Pure C# implementation of Suzuki-Abe border following algorithmSingle-pass contour detection algorithmDetects both outer contours and internal holesHierarchical contour organization with automatic parent-child relationshipsConfigurable pixel connectivity (4-connected or 8-connected)Custom predicate support for flexible pixel classificationBuilt-in alpha threshold detection for convenienceMip level support for multi-resolution processingCoordinate system automatically converted to Unity's Texture2D conventionAPI Highlights:ContourDetector.FindContoursOpaque() - Detect contours from fully opaque pixelsContourDetector.FindContoursByAlpha() - Threshold-based contour detectionContourDetector.FindContours() - Custom predicate-based detection for full controlContour.Points - Access detected contour point coordinatesContour.BoundingBox - Get contour bounding rectangleContour.IsHole - Identify hole vs. outer contoursContour.Parent - Navigate contour hierarchySample Components:ContourLineDrawer - Visualize contours using Unity LineRendererContourPixelDrawer - Draw contours directly on texture pixelsConfigurable visualization colors for outer contours and holesOptional hole filtering for simplified visualizationReal-time parameter adjustment in Unity EditorTesting:Comprehensive unit test coverage with NUnitTests validate algorithm correctness across various scenariosEdge cases thoroughly tested (empty images, single pixels, nested holes, etc.)Platform Support:All Unity platforms supported (pure managed code)No platform-specific native dependenciesCode Quality:Clean, maintainable C# codeExtensive XML documentation commentsAI assistance was used during development for:Initial code generation and algorithm implementationDocumentation writing and XML commentsUnit test case generationProduct description draftingAll AI-generated content was reviewed, validated, and edited by the developer. The core algorithm implementation was verified against the original Suzuki-Abe paper, and all code has been thoroughly tested with comprehensive unit tests.



