Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// <summary>
/// Run omr task
/// </summary>
/// <param name="actionName">Name of the omr action</param>
/// <param name="path">Path to file</param>
/// <param name="functionParams">Function parameters</param>
/// <param name="additionalParams">Additional parameters</param>
/// <returns>Response data</returns>
OmrResponse RunOmrTask(string actionName, string path, string functionParams, string additionalParams);
{
"Details": {
"RecognitionStatistics": [
{
"Name": "image1.jpg",
"TaskMessages": [],
"TaskResult": "Pass",
"RunSeconds": 3.4530858993530273
}
],
}
}
{
"ErrorCode": 0,
"ErrorText": "",
"Payload": {
"CompletedTaskId": "4f56d4ae-a65c-4a38-96da-9520aef42225",
"Result": {
"TemplateId": "4f56d4ae-a65c-4a38-96da-9520aef42225",
"ExecutionTime": 1.7034006118774414,
"Files": [
{
"Name": "test.dat",
"Size": 121,
"Data": "UXVlc3Rpb24xOkEKUXVlc3Rpb24yOkQKUXVlc3Rpb24zOkMKUXVlc3Rpb240OkIKUXVlc3Rpb241OkMKUXVlc3Rpb242OkMKUXVlc3Rpb243OkMKUXVlc3Rpb244OkIKUXVlc3Rpb245OkMKUXVlc3Rpb24xMDpDCg=="
}
],
"Info": {
"ResponseVersion": 0.4,
"ProcessedTasksCount": 1,
"SuccessfulTasksCount": 1,
"Details": {
"RecognitionStatistics": [
{
"Name": "image1.jpg",
"TaskMessages": [],
"TaskResult": "Pass",
"RunSeconds": 3.4530858993530273
}
],
}
}
}
}
}
// Instantiate Aspose Storage Cloud API SDK
StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH);
// Instantiate Aspose OMR Cloud API SDK
OmrApi target = new OmrApi(APIKEY, APPSID, BASEPATH);
// Set the image file name
string name = "SampleOmr.bmp";
// Set task parameters
OMRFunctionParam param = new OMRFunctionParam();
param.FunctionParam = templateData;
try
{
// Upload source file to aspose cloud storage
storageApi.PutCreate(name, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + name));
// Invoke Aspose.OMR Cloud SDK API to run OMR task
Com.Aspose.OMR.Model.OMRResponse response = target.PostRunOmrTask(name, "CorrectTemplate", param, null, null);
// Get files containing task results
FileInfo[] resultFiles = response.Payload.Result.ResponseFiles;
}
catch (Exception ex)
{
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
OmrResponse:
{
int ErrorCode;
string ErrorText;
Payload
{
string CompletedTaskId;
Result
{
string TemplateId;
double ExecutionTime;
Files[]
{
string Name;
long Size;
string Data;
}
Info
{
string ResponseVersion;
int ProcessedTasksCount,
int SuccessfulTasksCount,
Details;
}
}
}
}
{
"Details": {
"TaskMessages": [
"Initial image resolution was too low. We magnified image in 2.0 times"
],
"TaskResult": "Pass",
}
}
{
"ErrorCode": 0,
"ErrorText": "",
"Payload": {
"CompletedTaskId": "81d744bc-02aa-4b47-bcbf-76a8fd532a3d",
"Result": {
"TemplateId": "81d744bc-02aa-4b47-bcbf-76a8fd532a3d",
"ExecutionTime": 2.175485610961914,
"Files": [
{
"Name": "CorrectedTemplate.dat",
"Size": 2024,
"Data": "ewogICAgIm5hbWUiOiAiVGVtcGxhdGUiLCAKICAgICJ2ZXJzaW9uIjogIjAuNCIsIAogICAgInBhZ2VzIjogWwogICAgICAgIHsKICAgICAgICAgICAgIndpZHRoIjogMzM2MCwgCiAgICAgICAgICAgICJoZWlnaHQiOiA0NjIyLCAKICAgICAgICAgICAgImVsZW1lbnRzIjogWwogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogIkNob2ljZUJveCIsIAogICAgICAgICAgICAgICAgICAgICJhbGlnbmVkSG9yaXpvbnRhbGx5IjogdHJ1ZSwgCiAgICAgICAgICAgICAgICAgICAgImFsaWduZWRWZXJ0aWNhbGx5IjogZmFsc2UsIAogICAgICAgICAgICAgICAgICAgICJuYW1lIjogIlF1ZXN0aW9uMSIsIAogICAgICAgICAgICAgICAgICAgICJ3aWR0aCI6IDQ1Mi4wLCAKICAgICAgICAgICAgICAgICAgICAiaGVpZ2h0IjogNTYuMCwgCiAgICAgICAgICAgICAgICAgICAgInRvcCI6IDE0MTIuMCwgCiAgICAgICAgICAgICAgICAgICAgImxlZnQiOiA0MzQuMCwgCiAgICAgICAgICAgICAgICAgICAgImJ1YmJsZUhlaWdodCI6IDU0LjAsIAogICAgICAgICAgICAgICAgICAgICJidWJibGVXaWR0aCI6IDU0LjAsIAogICAgICAgICAgICAgICAgICAgICJidWJibGVzIjogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmFsdWUiOiAiQSIsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgInRvcCI6IDE0MTMuMCwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAibGVmdCI6IDQzNS4wLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpc1ZhbGlkIjogZmFsc2UKICAgICAgICAgICAgICAgICAgICAgICAgfSwgCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2YWx1ZSI6ICJCIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAidG9wIjogMTQxMy4wLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJsZWZ0IjogNTM3LjAsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgImlzVmFsaWQiOiB0cnVlCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmFsdWUiOiAiQyIsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgInRvcCI6IDE0MTMuMCwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAibGVmdCI6IDYzNS4wLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpc1ZhbGlkIjogdHJ1ZQogICAgICAgICAgICAgICAgICAgICAgICB9LCAKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgInZhbHVlIjogIkQiLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0b3AiOiAxNDEzLjAsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgImxlZnQiOiA3MzMuMCwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaXNWYWxpZCI6IHRydWUKICAgICAgICAgICAgICAgICAgICAgICAgfSwgCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2YWx1ZSI6ICJFIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAidG9wIjogMTQxMy4wLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJsZWZ0IjogODMxLjAsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgImlzVmFsaWQiOiB0cnVlCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLCAKICAgICAgICAgICAgICAgICAgICAibXVsdGlzZWxlY3QiOiBmYWxzZSwgCiAgICAgICAgICAgICAgICAgICAgIm9yaWVudGF0aW9uIjogIkhvcml6b250YWwiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0sIAogICAgICAgICAgICAiaW1hZ2VEYXRhIjogbnVsbAogICAgICAgIH0KICAgIF0sIAogICAgInRlbXBsYXRlSWQiOiBudWxsLCAKICAgICJmaW5hbGl6YXRpb25Db21wbGV0ZSI6IGZhbHNlCn0="
}
],
"Info": {
"ResponseVersion": 0.4,
"ProcessedTasksCount": 1,
"SuccessfulTasksCount": 1,
"Details": {
"TaskMessages": [
"Initial image resolution was too low. We magnified image in 2.0 times"
],
"TaskResult": "Pass",
}
}
}
}
}
{
"Details": {
"TaskMessages": [""],
"TaskResult": "Pass",
}
}
{
"ErrorCode": 0,
"ErrorText": "",
"Payload": {
"CompletedTaskId": "81d744bc-02aa-4b47-bcbf-76a8fd532a3d",
"Result": {
"TemplateId": "81d744bc-02aa-4b47-bcbf-76a8fd532a3d",
"ExecutionTime": 26.25801920890808,
"Files": [
{
"Name": "RecognitionResult.dat",
"Size": 182,
"Data": "ewogICAgIndhcm5pbmdzIjogWwogICAgICAgICJDYW4ndCByZWNvZ25pemUgdGVtcGxhdGUgaW1hZ2UhISEgUmVhc29uOiBCdWJibGVzIGZpbmRpbmcgZXJyb3IuIEJpZyBkaXNhZ3JlZW1lbnQgd2l0aCB0ZW1wbGF0ZTogaXMgMCBzaG91bGQgYmUgNSIKICAgIF0sIAogICAgInJlY29nbml0aW9uX3Jlc3VsdCI6IFtdCn0="
}
],
"Info": {
"ResponseVersion": 0.4,
"ProcessedTasksCount": 1,
"SuccessfulTasksCount": 1,
"Details": {
"TaskMessages": [""],
"TaskResult":"Pass",
}
}
}
}
}
//this is a test file
//this is a new file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.