Перекрестная ссылка на несколько значений в списке, которые попадают в пределы определенного отклонения Vision OCR C#C#

Место общения программистов C#
Ответить Пред. темаСлед. тема
Anonymous
 Перекрестная ссылка на несколько значений в списке, которые попадают в пределы определенного отклонения Vision OCR C#

Сообщение Anonymous »

При использовании Vision OCR в C# xamarin. Я обнаружил, что API возвращает текст, который должен находиться в одном регионе, в разных регионах. Это приводит к неожиданному поведению и неправильной обработке данных.

Чтобы решить эту проблему, мне необходимо извлечь координаты Y из ограничивающих рамок на линиях и сохранить сопутствующие данные.
Добавьте оба в список.
/>Сравнивайте каждую запись списка со всеми остальными. Когда две координаты Y попадают в пределы отклонения 10, их необходимо объединить.

Ниже я добавил расшифровку структуры кода. Я пробовал использовать кортежи, словари, структуры и т. д. Но не смог найти решения для перекрестных ссылок на значения ни для одного из них.

Есть ли у кого-нибудь указатель справа? направление?

ОБНОВЛЕНИЕ; Я добиваюсь хороших результатов, используя рекурсивный двоичный поиск в сочетании с компаратором кортежей. Я опубликую код, если/когда он заработает.

class Playground
{
public void meh()
{
//these are the boundingboxes of different regions when the returned value from the OCR api is parsed
// int[] arr=new int[]{ Left X, Top Y, Width, Height};
int[] arrA =new int[] { 178, 1141, 393, 91 };//item 3 xenos
int[] arrB =new int[] { 171, 1296, 216, 53 };//totaal 3items
int[] arrC =new int[] { 1183, 1134, 105, 51};//item 3 prijs
int[] arrD =new int[] { 1192, 1287, 107, 52 };//totaal prijs

//the strings as will be made available within the lines, as words
string strA = "item 3";
string strB = "totaal:";
string strC = "2,99";
string strD = "8,97";

//make list to hold our fake linedata
List ourLines = new List();
ourLines.Add(arrA); ourLines.Add(arrB); ourLines.Add(arrC); ourLines.Add(arrD);

//following structure is observed
for(int region = 0; region < 3; region++){
//3 regions for each region process lines
foreach(int[] lineData in ourLines)
{
//get Y coordinates from boundingbox which is: lineData[1]
//keep int in memory and link* words in the corresponding line to it.
//put int and its words in array outside region loop.
//repeat this a couple of 100 times

for (int words = 0; words < 180; words++)
{
//do stuff with words
}
}
}

//here i need a list with the Y coordinates (for example 1141, 1296,1134, 1287)
//cross reference all Y coordinates with eachother
//when they fall withing a deviation of 10 with another
//then build string with combined text
//search in text for words resembing 'total' and check if there is an approperiate monetary value.

//the above would link the values of arrays A + C and B + D.
//which causes the corresponding results to be; 'item 3 2.99' and 'totaal 8.97'
//currently the arrays A+B are returned in region one and C+D in region two. This also varies from image to image.

//necessary because vision OCR api sometimes decides that lists of productname + price do belong in 2 different regions
//same for totals, and this causes incorrect responses when reading the data. (like thinking the amount of products == the price
//so if you bought 3 items the ocr will think the total price is 3$. instead of 8.97 (when each item is 2.99)

//note, values are monetary and culture independant. so this can mean the values can be in xx.xx or xx,xx
//* with link i mean either make a tuple/list/struct/keyvaluepair/dictionary/or preferably something more approperiate.
// this code will be executed on android and iOS devices.. something lightweight is preferred.
}
}


Подробнее здесь: https://stackoverflow.com/questions/546 ... ation-visi
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «C#»