Convert hand-drawn patterns into machine learning-ready matrices with real-time processing and multiple export formats.
Draw2Matrix is a powerful Go-based drawing application that transforms hand-drawn patterns into machine-readable binary matrices. Built with the Fyne toolkit, it offers real-time conversion of drawings into various formats including CSV, MATLAB (with One-Hot Encoding), and PNG. Perfect for:
- 🎓 Creating machine learning datasets
- 📊 Pattern recognition research
- 🤖 AI/ML training data preparation
- 🎨 Digital pattern visualization
- 📚 Educational tools development
-
Enhanced Machine Learning Support:
- One-Hot Encoding for MATLAB export - Perfect for neural networks
- Matrix counter with progress tracking
- Real-time status updates with animations
-
Improved Drawing Tools:
- Responsive paint window with precise input
- Advanced image processing for accurate pattern recognition
- Real-time preview of matrix conversion
-
Performance Optimizations:
- Efficient light theme UI for better pattern visibility
- Streamlined initialization process
- Optimized codebase for faster processing
- Real-time conversion of drawings to binary matrices
- Automated pattern detection and processing
- Intelligent matrix size adaptation
- Multiple format support:
- CSV export with optional flattening
- MATLAB format with One-Hot Encoding
- High-resolution PNG image export
- Batch processing capabilities
- Custom label support
- Intuitive drawing interface
- Dynamic matrix size adjustment
- Customizable output options:
- Row/Column flattening
- Matrix dimension control
- Label management system
- Go: Version 1.22 or later
- Fyne: v2.x toolkit
- OS Support: Windows, macOS, Linux
# Clone the repository
git clone https://github.com/ehsan-torabi/Draw2Matrix.git
# Navigate to project directory
cd Draw2Matrix
# Install dependencies
go mod download
# Run the application
go run .
-
Starting Up:
# Run the compiled executable ./Draw2Matrix # Or use Go directly go run .
-
Matrix Configuration:
- Set your desired matrix dimensions
- Choose output format:
- Standard matrix
- Flattened matrix
- One-Hot encoded (MATLAB)
- Apply settings with "Save Settings"
-
Drawing Interface:
- Use the enhanced paint window for drawing
- Real-time matrix conversion
- Track additions with the matrix counter
- Clear canvas option available
-
Export Process:
- Add descriptive labels
- Select export directory
- Choose format:
- CSV (with flattening options)
- MATLAB (with One-Hot encoding)
- PNG image
- Monitor progress through animated status updates
Input,Target
[1 0 1 0],label # Flattened format
The application generates optimized MATLAB-compatible files:
-
Matrix Data (
data.txt
):% Standard Format [ 1 0 1; 0 1 0; 1 1 0 ]
-
Labels (
target.txt
):[ 'A' 'B' 'C' ] % One-Hot Encoded Format [ 1 0 0; 0 1 0; 0 0 1 ]
- Core Components:
main.go
: Entry point and core application logicpaintWindow.go
: Enhanced drawing interfaceimageTools.go
: Advanced image processingdataTools.go
: Data handling and export functionscontrolFunctions.go
: UI control managementcustomWidget.go
: Custom widget implementations
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
We welcome contributions! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Go - Modern, fast programming language
- Fyne - Cross-platform GUI toolkit
- bild - Advanced image processing
- 📧 Author: Ehsan Torabi
- 💬 Telegram: @ehsan_torabi_frs
- 🌟 Project: Draw2Matrix on GitHub
- 📄 License: MIT License - View License
pattern recognition
, machine learning
, data preprocessing
, matrix conversion
, golang
, fyne
, drawing tool
, binary matrix
, dataset creation
, educational tool
, AI training
, cross-platform
, open source