Skip to content

Instantly share code, notes, and snippets.

View GenchoBG's full-sized avatar

Evgeni Dimov GenchoBG

  • Argo Ventures Digital Ltd.
  • Sofia, Bulgaria
View GitHub Profile
@GenchoBG
GenchoBG / TextExtractor.cs
Created April 14, 2019 11:49
Used to extracting the product number from a label
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Azure.CognitiveServices.Vision.ComputerVision;
using Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models;
namespace Recognize_TextSdk
{
public static class TextExtractor
@GenchoBG
GenchoBG / JsonParser.cs
Created April 14, 2019 11:53
Parsing the JSON files with coordinates from our Machine Learning model
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Recognize_TextSdk;
@GenchoBG
GenchoBG / IsEverythingFine.cs
Last active April 14, 2019 14:41
Once the have the data loaded we pass it into this function which identifies if there is an error.
public static bool IsEverythingFine(List<SubPicture> subPictures)
{
const int tolerance = 100;
var labels = subPictures.Where(sp => sp.Label.Contains("label")).ToList();
var maxItemY = subPictures.Except(labels).Min(i => i.TopLeft.Y);
foreach (var label in labels.ToArray())
{
if (label.TopLeft.Y < maxItemY)
@GenchoBG
GenchoBG / XMLProcessing.cs
Created April 15, 2019 07:30
Process all of the XML annotation file in the desired format & generate the labels.txt file needed to train our model
using System;
using System.IO;
using System.Text.RegularExpressions;
namespace XMLProcessing
{
class Program
{
public static void Main(string[] args)
{