定制 aspose/aspose-omr-cloud 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aspose/aspose-omr-cloud

Composer 安装命令:

composer require aspose/aspose-omr-cloud

包简介

PHP library for communicating with the Aspose.OMR Cloud API

README 文档

README

Aspose.OMR Cloud is an easy-to-use and versatile online service for designing, rendering and recognizing hand-filled answer sheets, exam papers, surveys, ballots, and similar forms. With it, you can quickly develop web applications for optical mark recognition (OMR) that require minimal resources on the client side.

This software development kit (SDK) simplifies the interaction with Aspose.OMR Cloud services, allowing you to focus on business logic rather than the technical details. It handles all the routine operations such as establishing connections, sending API requests, and parsing responses, wrapping all these tasks into a few simple methods that can be used in PHP code.

Contents of this package

The repository contains:

  • Aspose.OMR Cloud SDK for PHP
  • Demo project - a simple web application that demonstrates how to use Aspose.OMR Cloud SDK for PHP for generating and recognizing OMR forms.
  • Demo data (aspose-omr-cloud-demo-data):
    • Configuration file (aspose-omr-cloud-demo-data/test_config.json);
    • Source code of the questionnaire, associated images, and a scanned image of the filled questionnaire for recognition test (aspose-omr-cloud-demo-data/Data);
    • The directory for storing a generated printable form, recognition pattern (.OMR) file, and recognition results (aspose-omr-cloud-demo-data/Temp).

Licensing

Aspose.OMR Cloud SDK for PHP, demo site, documentation, and form templates are distributed under MIT License.

Prerequisites

Windows environment

Make sure that local repository path and all paths to all required packages do not exceed 255 symbols.

Aspose.OMR Cloud use Guzzle library to perform REST requests. Guzzle framework uses cURL (libcurl) as transport library. On the Windows platform, you may encounter problems accessing HTTPS resources depending on the version of libcurl you are using.

  • If you are using libcurl built with OpenSSL, download CA Certificates and update your php.ini:

    [curl]
    curl.cainfo="<full path to cacert.pem file>"
    [openssl]
    openssl.cafile="<full path to cacert.pem file>"
    
  • If you are using libcurl built with WinSSL, you are good to go because WinSSL uses the Windows certificate store.

OpenSSL and WinSSL-based versions of libcurl can be downloaded at https://curl.haxx.se/gknw.net/7.40.0/. Choose your platform (x86 or x64), OpenSSL (look for ssl string in the file name) or WinSSL (look for winssl string in the file name).

Authorization

Aspose.OMR Cloud follows industry standards and best practices to keep your data secure. All communication with OCR REST API is done using JWT authentication, which provides an open-standard, highly secure way to exchange information. Time-limited JWT tokens are generated using Client ID and Client Secret credentials that are specific for each application.

  1. Sign in to Aspose Cloud API Dashboard.
  2. Go to Applications page.
  3. Create the storage for exchanging files by clicking the plus icon and following the required steps. You can either use your own cloud storage, create a new storage in our cloud, or reuse the existing one.
  4. Give the application an easily recognizable name so it can be quickly found in a long list.
  5. Click Save button.
  6. Click the newly created application and copy the values from Client Id and Client Secret fields.

Installation and usage

  1. Clone or download the repository.

  2. To install the bindings via Composer, add the following to composer.json:

    {
      "repositories": [
        {
          "type": "git",
          "url": "https://github.com/aspose-omr-cloud/aspose-omr-cloud-php.git"
        }
      ],
      "require": {
        "aspose/aspose-omr-cloud": "*@dev"
      }
    }

    Then run composer install.

  3. Run the demo project. The actual steps may vary depending on your platform.

The web application generates a printable OMR-ready form (aspose-omr-cloud-demo-data/Temp/Aspose_test.png) along with the recognition pattern file (aspose-omr-cloud-demo-data/Temp/Aspose_test.omr). The latter is used by Aspose.OMR recognition engine to match filled bubbles with template fields.

Then it recognizes the scanned image of the filled questionnaire and saves results in aspose-omr-cloud-demo-data/Temp/Aspose_test.csv file.

Configuring

The configuration file (aspose-omr-cloud-demo-data/test_config.json) contains the basic parameters for working with Aspose.OMR Cloud.

  • app_key - the value from Client Secret field of the application (see Authorization).
  • app_sid - the value from Client Id field of the application (see Authorization).
  • base_path - root URL of Aspose.OMR Cloud service.
  • data_directory - path to the directory with the source code of the questionnaire, associated images and scanned images of the filled questionnaires. Specify the path relative to the configuration file.
  • result_directory - path to the directory for storing a generated printable form, recognition pattern and recognition results. Specify the path relative to the configuration file.

How it works?

Aspose.OMR Cloud supports end-to-end OMR process - from designing a form to recognizing its filled hardcopies. The workflow includes the following stages:

Stages of the OMR process

All resource-consuming tasks (generation and recognition of OMR forms) are done in the cloud, freeing up resources on the end user's device. All cloud tasks are queued, which prevents multiple simultaneous requests from interfering with each other and consuming too much processor time.

Aspose.OMR Cloud SDK for PHP implements wrapper classes that allow you to interact with the Aspose.OMR Cloud REST API without writing low-level HTTP requests and parsing responses. The demo project source code contains extensive comments on all major parts of the code, so you can easily understand the basics without having to consult the SDK reference documentation.

Generating a printable form

To generate a printable form and a recognition pattern file, send the form sources and page configuration to the Aspose.OMR Cloud queue and get the results a few seconds later.

The processing time can vary from a few milliseconds to a couple of seconds, depending on the current load of the Aspose.OMR Cloud service.

GenerateTemplate

This class contains wrapper methods for generating the printable form from the source code and working with the form generation queue.

OmrGenerateTask

This class allows you to prepare a request for sending the form source code, associated images, and page layout to the generation queue.

Page layout

The paper size, orientation, font, and other layout settings are configured through PageSettings object which is passed to the OmrGenerateTask constructor.

Working with images

Aspose.OMR Cloud allows you to customize forms by adding images (such as your company logo) to them. In addition to describing the image element in the form's source code, each image file must be directly submitted to the generation queue.

Images are provided to the OmrGenerateTask constructor as a HashMap, where the key contains the image file name, and the value contains the contents of the image file as an array of bytes.

OMRResponse

Depending on the request type, this class contains:

  • The current state of the queued form generation request, along with the printable OMR form and recognition pattern file, if the form has been generated.
  • The current state of the queued form recognition request, along with recognition results, if the form has been recognized.

Recognizing a filled form

To recognize the filled form, send its scanned image or photo along with the recognition pattern file to the Aspose.OMR Cloud queue and get the results a few seconds later.

The processing time can vary from a few milliseconds to a couple of seconds, depending on the current load of the Aspose.OMR Cloud service.

RecognizeTemplate

This class contains wrapper methods for recognizing the scanned or photographed form and working with the form recognition queue.

OmrRecognizeTask

This class allows you to prepare a request for sending the form image to the recognition queue.

The form must be accompanied by the recognition pattern (.OMR) file, which tells Aspose.OMR recognition engine how to match filled bubbles with template fields. Please note that the recognition template file must be taken from the same generation response as the printable form, otherwise the recognition results are not guaranteed to be correct.

Recognition accuracy threshold

A respondent can fill out the form with a pen, pencil or marker, and use various marks inside the bubbles - from a solid fill to small crosses or checks.

Recognition accuracy threshold (recognitionThreshold) parameter determines how marks are processed during recognition. You can provide a value from 0 to 100. Lower values allow even the lightest marks to be recognized, but may cause dirt or paper defects to be treated as marks. Higher values require a more solid fill and may cause pencil marks or small checkmarks to be ignored.

Recognition accuracy threshold

Important: Instruct respondents to use the same type of marks for all bubbles. Otherwise, recognition results may be inaccurate. If you plan to use your smartphone's camera instead of a scanner, we recommend a solid fill with a pen or marker.

Resources

aspose/aspose-omr-cloud 适用场景与选型建议

aspose/aspose-omr-cloud 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21 次下载、GitHub Stars 达 4, 最近一次更新时间为 2018 年 08 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「sdk」 「cloud」 「aspose」 「omr」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 aspose/aspose-omr-cloud 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 aspose/aspose-omr-cloud 我们能提供哪些服务?
定制开发 / 二次开发

基于 aspose/aspose-omr-cloud 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 9
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-29