Characters are now outlined correctly in the preview
This commit is contained in:
@@ -100,14 +100,10 @@ namespace TestVideo
|
|||||||
if (creatingZone)
|
if (creatingZone)
|
||||||
{
|
{
|
||||||
//Convert coordinates to image coordinates
|
//Convert coordinates to image coordinates
|
||||||
|
|
||||||
//Rectangle screenSize = extraction.CurrentScreen.Bounds;
|
|
||||||
float xRatio = (float)pbxInput.Image.Width / (float)pbxInput.Width;
|
float xRatio = (float)pbxInput.Image.Width / (float)pbxInput.Width;
|
||||||
float yRatio = (float)pbxInput.Image.Height / (float)pbxInput.Height;
|
float yRatio = (float)pbxInput.Image.Height / (float)pbxInput.Height;
|
||||||
Point tmpPoint = pbxInput.PointToClient(MousePosition);
|
Point tmpPoint = pbxInput.PointToClient(MousePosition);
|
||||||
Point testPoint = 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));
|
Point newPoint = new Point(Convert.ToInt32((float)tmpPoint.X * xRatio),Convert.ToInt32((float)tmpPoint.Y * yRatio));
|
||||||
|
|
||||||
if (newZonePoints[0] == new Point(-1,-1))
|
if (newZonePoints[0] == new Point(-1,-1))
|
||||||
@@ -197,8 +193,6 @@ namespace TestVideo
|
|||||||
float yRatio = (float)pbxInput.Image.Height / (float)pbxInput.Height;
|
float yRatio = (float)pbxInput.Image.Height / (float)pbxInput.Height;
|
||||||
Point tmpPoint = pbxInput.PointToClient(new Point(MousePosition.X,MousePosition.Y));
|
Point tmpPoint = pbxInput.PointToClient(new Point(MousePosition.X,MousePosition.Y));
|
||||||
Point testPoint = 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));
|
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();
|
debugLBL.Text = "Absolute : " + testPoint.ToString() + Environment.NewLine + "Relative : " + tmpPoint.ToString();
|
||||||
|
|||||||
@@ -57,15 +57,19 @@ namespace TestVideo
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
string letter = data[0];
|
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]));
|
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]);
|
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
|
//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
|
//Use the data
|
||||||
result += letter;
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user