Skip to content

Conversation

@wangfu91
Copy link
Owner

No description provided.

wangfu91 added 2 commits July 22, 2025 09:57
Introduces the ImageInput enum to support multiple image sources (file path, buffer, dynamic image) for OCR processing. Adds OcrOptions struct for configurable OCR behavior, including word-level details and resize resolution. Refactors OcrEngine to use these abstractions, updates examples and benchmarks to the new API, and improves FFI bindings for model delay load.
@wangfu91 wangfu91 self-assigned this Jul 22, 2025
Copilot AI review requested due to automatic review settings July 22, 2025 10:13

This comment was marked as outdated.

@wangfu91 wangfu91 requested a review from Copilot July 22, 2025 14:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the OCR library to improve input handling and configuration management by introducing structured options and flexible image input types. The refactoring enhances the API design while maintaining backward compatibility through default implementations.

  • Introduces OcrOptions struct for centralized configuration management including max line count, resize resolution, and word-level detail settings
  • Adds ImageInput enum to support multiple input sources (file paths, image buffers, and dynamic images) with convenient From trait implementations
  • Refactors the OcrEngine::run method to accept the new input types and use configuration from the options struct

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ocr_options.rs Defines new OcrOptions and Resolution structs with default implementations
src/ocr_engine.rs Refactors engine to use options-based initialization and flexible image input handling
src/lib.rs Exports new public types for options and image input
src/image_input.rs Implements ImageInput enum with conversion traits for different input types
src/ffi.rs Updates FFI function signature to accept delay load parameter
src/errors.rs Updates comment format from inline to doc comment
src/bounding_box.rs Fixes missing closing bracket in display format string
examples/*.rs Updates examples to use new API with options and input types
benches/benchmark.rs Updates benchmarks to use new API structure

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@wangfu91 wangfu91 merged commit dc76f88 into master Jul 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant