Skip to content

iOS app with OCR and translation: Extract text from images using Vision framework and translate with built-in Translation API. SwiftUI + educational project.

License

Notifications You must be signed in to change notification settings

dmakarau/ImageRecognitionApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Recognition App 📱

A modern iOS application built with SwiftUI that combines optical character recognition (OCR) with real-time translation capabilities. Select an image, extract text using Apple's Vision framework, and translate it instantly using the built-in Translation API.

iOS Swift SwiftUI Vision Translation Xcode License Learning

✨ Features

  • Image Gallery: Browse through a collection of sample images with text
  • Photo Picker: Select custom images from your photo library for analysis
  • Text Recognition: Extract text from images using Apple's advanced Vision framework
  • Real-time Translation: Translate recognized text into multiple languages
  • Modern UI: Clean, intuitive interface built with SwiftUI
  • Custom Theme: Beautiful background design with consistent styling
  • Progress Indicators: Visual feedback during text processing

🛠 Technology Stack

  • SwiftUI: Modern declarative UI framework
  • PhotosUI: Native photo picker for custom image selection
  • Vision Framework: Apple's machine learning framework for text recognition
  • Translation API: Built-in iOS translation capabilities
  • Swift: Native iOS development language
  • iOS 17.0+: Minimum deployment target

📱 Screenshots

The app includes a gallery of sample images (sign1-sign9) that demonstrate various text recognition scenarios.

🏗 Project Structure

ImageRecongnitionApp/
├── App/
│   └── ImageRecongnitionAppApp.swift          # Main app entry point
├── Core/
│   ├── Models/
│   │   └── TextRecognizer.swift               # OCR logic using Vision framework
│   ├── Views/
│   │   ├── ContentView.swift                  # Main navigation view
│   │   ├── ImageGalleryView.swift             # Image selection grid
│   │   ├── TextRecognitionView.swift          # Image display and processing
│   │   └── TranslationView.swift              # Text display and translation
│   └── Modifiers/
│       └── TrailTheme.swift                   # Custom theme modifier
└── Resources/
    └── Assets.xcassets/                       # Images and app assets

🚀 Getting Started

Prerequisites

  • Xcode 15.0 or later
  • iOS 17.0 or later
  • macOS Ventura or later

Installation

  1. Clone the repository:
git clone https://github.com/dmakarau/ImageRecognitionApp.git
  1. Open the project in Xcode:
cd ImageRecognitionApp
open ImageRecongnitionApp.xcodeproj
  1. Build and run the project:
    • Select your target device or simulator
    • Press Cmd + R to build and run

🎯 Usage

  1. Launch the App: Open the app to see the main gallery view
  2. Choose an Image:
    • Predefined Images: Tap on any sample image from the 3x3 grid to analyze it
    • Custom Images: Tap the "Select Custom Image" button to choose a photo from your library
  3. View Results: The app will automatically extract text from the selected image
  4. Translate: Tap the "Translate" button to open the translation interface
  5. Choose Language: Select your target language and view the translation

🔧 Core Components

TextRecognizer

The heart of the OCR functionality, using Apple's Vision framework:

  • Supports both ImageResource (bundled images) and UIImage (custom photos)
  • Processes images with high accuracy recognition level
  • Extracts text observations and candidates
  • Returns recognized text as a concatenated string

ImageGalleryView

A responsive layout with both predefined and custom image options:

  • 3x3 grid of navigation-enabled sample image thumbnails
  • PhotosPicker integration for selecting custom images from photo library
  • Seamless navigation to text recognition views
  • Rounded corners and visual styling for enhanced UX

TranslationView

Handles the translation workflow:

  • Displays recognized text with loading states
  • Integrates with iOS Translation API
  • Provides accessible translation interface

🎨 Design Features

  • Custom Theme: Consistent background and styling throughout the app
  • Responsive Layout: Adapts to different screen sizes and orientations
  • Loading States: Visual feedback during processing
  • Navigation: Intuitive flow between screens

📋 Requirements

  • iOS 17.0+
  • Xcode 15.0+
  • Swift 5.9+

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

🔮 Future Enhancements

  • Camera integration for live photo capture
  • Support for multiple image formats
  • Text editing capabilities before translation
  • History of recognized texts and custom images
  • Batch processing of multiple images
  • Export functionality for recognized text
  • Save custom images to app's local storage
  • Enhanced photo picker with cropping capabilities

📝 Notes

This project was created as a learning exercise to explore:

  • SwiftUI's modern declarative syntax
  • Apple's Vision framework capabilities
  • iOS Translation API integration
  • Clean architecture patterns in iOS development

⭐ If you found this project helpful, please consider giving it a star!

About

iOS app with OCR and translation: Extract text from images using Vision framework and translate with built-in Translation API. SwiftUI + educational project.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages