public bool addphone(Root d1, Rootobject obj, myobject myobj) { Shape s1 = new Shape(); int i = 0; foreach (Shape s in d1.shapes) { if (s.group_id == myobj.label) { i++; } } s1.label = mobilelabel[i]; s1.shape_type = "Rectangle"; s1.group_id = myobj.label; s1.text_field = myobj.text; s1.points = new List <List <double> >(); s1.points.AddRange(t1.pointfinder(myobj.searchtext, obj, myobj)); d1.shapes.Add(s1); return(true); }
public bool addother(Root d1, Rootobject obj, myobject myobj) { // List<string> label = new List<string>() { "Field_1", "Field_2", "Field_3", "Field_4", "Field_5", "Field_6", "Field_7", "Field_8", "Field_9", "Field_10", "Field_11", "Field_12", "Field_13", "Field_14", "Field_15", "Field_16", "Field_17", "Field_18", "Field_19", "Field_20", "Field_21" }; int i = 0; for (int j = 0; j < d1.shapes.Count(); j++) { if (d1.shapes[j].group_id == "Others") { i++; } } Shape s1 = new Shape(); s1.label = label[i]; s1.shape_type = "Rectangle"; s1.group_id = "Others"; s1.text_field = myobj.text; s1.points = new List <List <double> >(); s1.points.AddRange(t1.pointfinder(myobj.text, obj, myobj)); d1.shapes.Add(s1); return(true); }
public bool addbusiness(Root d1, Rootobject obj, myobject myobj) { List <string> label = new List <string>() { "Field_1", "Field_2", "Field_3", "Field_4", "Field_5", "Field_6", "Field_7", "Field_8", "Field_9", "Field_10" }; List <string> text = myobj.text.Split(' ').ToList(); int i = 0; foreach (string str in text) { Shape s1 = new Shape(); s1.label = label[i]; s1.shape_type = "Rectangle"; s1.group_id = "BusinessType"; s1.text_field = str; s1.points = new List <List <double> >(); s1.points.AddRange(t1.pointfinder(str, obj, myobj)); d1.shapes.Add(s1); i++; } return(true); }
public bool addemail(Root d1, Rootobject obj, myobject myobj) { Shape s1 = new Shape(); s1.label = "Address"; s1.shape_type = "Rectangle"; s1.group_id = "Email"; s1.text_field = myobj.text; s1.points = new List <List <double> >(); s1.points.AddRange(t1.pointfinder(myobj.searchtext, obj, myobj)); d1.shapes.Add(s1); return(true); }
public bool addcard(Root d1, Rootobject obj, myobject myobj) { Shape s1 = new Shape(); s1.label = "CardArea"; s1.shape_type = "Rectangle"; s1.group_id = "CARDAREA"; s1.text_field = ""; s1.points = new List <List <double> >(); s1.points.AddRange(t1.pointfinder(myobj.searchtext, obj, myobj)); d1.shapes.Add(s1); return(true); }
public bool addcompanyname(Root d1, Rootobject obj, myobject myobj) { List <string> text = myobj.text.Split(' ').ToList(); int i = 0; foreach (string str in text) { Shape s1 = new Shape(); s1.label = label[i]; s1.shape_type = "Rectangle"; s1.group_id = "CompanyName"; s1.text_field = str; s1.points = new List <List <double> >(); s1.points.AddRange(t1.pointfinder(str, obj, myobj)); d1.shapes.Add(s1); i++; } return(true); }
public bool addname(Root d1, Rootobject obj, string prefix, string fname, string mname, string lname, myobject myobject1) { if (prefix != "") { Shape s1 = new Shape(); s1.label = "NamePrefix"; s1.shape_type = "Rectangle"; s1.group_id = "Name"; s1.text_field = prefix; s1.points = new List <List <double> >(); s1.points.AddRange(t1.pointfinder(prefix, obj, myobject1)); d1.shapes.Add(s1); } if (fname != "") { Shape s1 = new Shape(); s1.label = "FirstName"; s1.shape_type = "Rectangle"; s1.group_id = "Name"; s1.text_field = fname; s1.points = new List <List <double> >(); foreach (var l1 in t1.pointfinder(fname, obj, myobject1)) { s1.points.Add(l1); } // s1.points.Add(t1.pointfinder(fname, obj)[1]); d1.shapes.Add(s1); } if (mname != "") { Shape s1 = new Shape(); s1.label = "MiddleName"; s1.shape_type = "Rectangle"; s1.group_id = "Name"; s1.text_field = mname; s1.points = new List <List <double> >(); s1.points.AddRange(t1.pointfinder(mname, obj, myobject1)); d1.shapes.Add(s1); } if (lname != "") { Shape s1 = new Shape(); s1.label = "LastName"; s1.shape_type = "Rectangle"; s1.group_id = "Name"; s1.text_field = lname; s1.points = new List <List <double> >(); s1.points.AddRange(t1.pointfinder(lname, obj, myobject1)); d1.shapes.Add(s1); } return(true); }
public List <List <double> > pointfinder(string s1, Rootobject ocrResult, myobject myobject1) { List <List <double> > points = new List <List <double> >(); List <double> p1 = new List <double>(); p1.Add(0); p1.Add(0); int x = myobject1.mousex; int y = myobject1.mousey; for (int i = 0; i < ocrResult.ParsedResults.Count(); i++) { for (int k = 0; k < ocrResult.ParsedResults[i].textOverlay.lines.Count(); k++) { for (int j = 0; j < ocrResult.ParsedResults[i].textOverlay.lines[k].words.Count(); j++) { float left = (int)(ocrResult.ParsedResults[i].textOverlay.lines[k].words[j].Left); float top = (int)(ocrResult.ParsedResults[i].textOverlay.lines[k].words[j].Top); float width = (int)(ocrResult.ParsedResults[i].textOverlay.lines[k].words[j].Width); float hight = (int)(ocrResult.ParsedResults[i].textOverlay.lines[k].MaxHeight); // if (x > left && x < left + width) { if (myobject1.label == "others" || y > top && y < (top + hight)) { if (ocrResult.ParsedResults[i].textOverlay.lines[k].words[j].WordText == s1) { double lft1 = ocrResult.ParsedResults[i].textOverlay.lines[k].words[j].Left; double top1 = ocrResult.ParsedResults[i].textOverlay.lines[k].words[j].Top; double hight1 = ocrResult.ParsedResults[i].textOverlay.lines[k].words[j].Height; double width1 = ocrResult.ParsedResults[i].textOverlay.lines[k].words[j].Width; // p1 = new List<double>(); // p1[0] = lft; // p1[1] = top - hight; points.Add(new List <double> { lft1, top1 + hight1 }); //top point left // p1[0] = lft; // p1[1] = top; // points.Add(p1); points.Add(new List <double> { lft1, top1 }); //bottom point lft // p1[0] = lft+width; // p1[1] = top; // points.Add(p1); points.Add(new List <double> { lft1 + width1, top1 }); //bottom point right // p1[0] = lft+width; // p1[1] = top-hight; // points.Add(p1); points.Add(new List <double> { lft1 + width1, top1 + hight1 }); //top point right x = (int)(left + width / 2); y = (int)(top + hight / 2); } } } } } } return(points); }