Characters are now outlined correctly in the preview

This commit is contained in:
2022-11-02 13:39:01 +01:00
parent 11715e3bab
commit 5a91d2e27a
2 changed files with 6 additions and 8 deletions

View File

@@ -100,14 +100,10 @@ namespace TestVideo
if (creatingZone)
{
//Convert coordinates to image coordinates
//Rectangle screenSize = extraction.CurrentScreen.Bounds;
float xRatio = (float)pbxInput.Image.Width / (float)pbxInput.Width;
float yRatio = (float)pbxInput.Image.Height / (float)pbxInput.Height;
Point tmpPoint = pbxInput.PointToClient(MousePosition);
Point testPoint = MousePosition;
//MouseEventArgs me = (MouseEventArgs)e;
//Point tmpPoint = me.Location;
Point newPoint = new Point(Convert.ToInt32((float)tmpPoint.X * xRatio),Convert.ToInt32((float)tmpPoint.Y * yRatio));
if (newZonePoints[0] == new Point(-1,-1))
@@ -197,8 +193,6 @@ namespace TestVideo
float yRatio = (float)pbxInput.Image.Height / (float)pbxInput.Height;
Point tmpPoint = pbxInput.PointToClient(new Point(MousePosition.X,MousePosition.Y));
Point testPoint = MousePosition;
//MouseEventArgs me = (MouseEventArgs)e;
//Point tmpPoint = me.Location;
Point newPoint = new Point(Convert.ToInt32((float)tmpPoint.X * xRatio), Convert.ToInt32((float)tmpPoint.Y * yRatio));
debugLBL.Text = "Absolute : " + testPoint.ToString() + Environment.NewLine + "Relative : " + tmpPoint.ToString();

View File

@@ -57,15 +57,19 @@ namespace TestVideo
break;
string letter = data[0];
//Point position = new Point(Convert.ToInt32(data[1]), Convert.ToInt32(data[2]));
//Size size = new Size(Convert.ToInt32(data[3]), Convert.ToInt32(data[4]));
Point position = new Point(Convert.ToInt32(data[1]), Convert.ToInt32(data[2]));
Size size = new Size(Convert.ToInt32(data[3]), Convert.ToInt32(data[4]));
Size size = new Size(Convert.ToInt32(data[3]) - Convert.ToInt32(data[1]), Convert.ToInt32(data[4]) - Convert.ToInt32(data[2]));
Point correctedPosition = new Point(position.X, inputBmp.Height - position.Y - size.Height);
int unknownData = Convert.ToInt32(data[5]);
//A neat post processing Idea would be to separate letters that have a unusually big difference in X or Y axis to try and recognise words
//Use the data
result += letter;
g.DrawRectangle(new Pen(Brushes.Red, 5), new Rectangle(position, size));
//g.DrawRectangle(new Pen(Brushes.Red, 5), new Rectangle(position, size));
g.DrawRectangle(new Pen(Brushes.Red, 3), new Rectangle(correctedPosition, size));
}
}